feat: refactor register, bind, and proxy to use s_expressions #32
feat: refactor register, bind, and proxy to use s_expressions #32
Conversation
|
I love it!! |
| @@ -0,0 +1,16 @@ | |||
| ### Pre-req | |||
| 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.
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.
Which hashes? the salt? or you just mean in the flag/command names?
There was a problem hiding this comment.
The salt on the end. That's just a crc of the word functionless lol
There was a problem hiding this comment.
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.
| 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.
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.visit_mut_children_with(self) | ||
| } | ||
| } | ||
| Expr::Call(call) => { |
There was a problem hiding this comment.
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.
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.

Depends on: sam-goodwin/functionless#520