-
-
Notifications
You must be signed in to change notification settings - Fork 337
Basic canonicalize_expr of idents with tests #7806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good. My only question is around how we will do snapshots for Can, but I'm sure we will get to that soon.
Ok, update on this. I've gone ham on getting it compiling and the test passing again. I haven't made a pass over the changes in any great depth yet. So I would consider this a WIP and not ready for merging right now. But it should be much easier to go through it now and fix issues. |
var items = collections.SafeList(CIR.Expr.Idx).initCapacity(self.can_ir.env.gpa, 0); | ||
const items_slice = self.parse_ir.store.exprSlice(e.items); | ||
|
||
for (items_slice) |item| { | ||
if (self.canonicalize_expr(item)) |canonicalized| { | ||
_ = items.append(self.can_ir.env.gpa, canonicalized); | ||
} | ||
} | ||
|
||
const fresh_type_var = self.can_ir.type_store.fresh(); | ||
|
||
// Mark the start of scratch expressions for the list | ||
const scratch_top = self.can_ir.store.scratchExprTop(); | ||
|
||
// Add all canonicalized items to scratch | ||
var iter = items.iterIndices(); | ||
while (iter.next()) |idx| { | ||
self.can_ir.store.addScratchExpr(items.get(idx).*); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to have the allocation of items
here? Can we just append straight to scratch?
const scratch_top = self.can_ir.store.scratchExprTop();
const items_slice = self.parse_ir.store.exprSlice(e.items);
for (items_slice) |item| {
if (self.canonicalize_expr(item)) |canonicalized| {
self.can_ir.store.addScratchExpr(canonicalized);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed this yet, but I think we can land it just to get something going on main
. 😄
This is just me getting this started and sharing things so that I can make sure I understand what we are trying to accomplish correct.