-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: refactor register, bind, and proxy to use s_expressions #32
base: main
Are you sure you want to change the base?
Conversation
I love it!! |
@@ -0,0 +1,16 @@ | |||
### Pre-req |
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.
Thank you!
src/closure_decorator.rs
Outdated
const REGISTER_FLAG: &str = "REGISTER_8269d1a8"; | ||
// (REGISTER_REF,stash[]=ast) | ||
const REGISTER_REF_FLAG: &str = "REGISTER_REF_8269d1a8"; | ||
// // (BIND, ...) | ||
const BIND_FLAG: &str = "BIND_8269d1a8"; | ||
// // (PROXY, ...) | ||
const PROXY_FLAG: &str = "PROXY_8269d1a8"; | ||
|
||
const GLOBAL_THIS_NAME: &str = "global_8269d1a8"; |
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 think we can get rid of the hashes now. The chance of this occurring is almost zero
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.
Which hashes? the salt? or you just mean in the flag/command names?
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.
The salt on the end. That's just a crc of the word functionless lol
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.
It can be removed from the flag/command names, I originally tried to put the string there without setting stash, but something strips the string off as a no-op.
src/closure_decorator.rs
Outdated
items.push(ModuleItem::Stmt(Stmt::Expr(ExprStmt { | ||
expr: Box::new(Expr::Assign(AssignExpr { | ||
span: DUMMY_SP, | ||
op: AssignOp::Assign, | ||
left: PatOrExpr::Expr(Box::new(Expr::Ident(self.stash.clone()))), | ||
right: undefined_expr(), | ||
})), | ||
span: DUMMY_SP, | ||
}))) |
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.
Why?
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.
Ah, woops. I noticed that the stash value was being serialized and tried to clear the value, but this didn't work because it would need to cleared from the nested scopes too. Will remove.
} | ||
} | ||
Expr::Call(call) => { |
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.
Did you remove the visit_mut_call_expr handler? I don't think those two can co-exist
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 did! I was scrambling to figure out how to return a different node type and found this beautiful function :-) the other one is removed.
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.
Depends on: functionless/functionless#520