fix(ast): estree compat Function#8972
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
FunctionBodyFunctionBody
FunctionBodyFunction
CodSpeed Performance ReportMerging #8972 will not alter performanceComparing Summary
|
af3bf21 to
a7e07fa
Compare
c19cc51 to
840c440
Compare
d9257fe to
e5ab419
Compare
| pub directives: Vec<'a, Directive<'a>>, | ||
| #[estree(rename = "body")] | ||
| pub statements: Vec<'a, Statement<'a>>, |
There was a problem hiding this comment.
both directives and statements should be in body, but append_to macro seems to break for non optional field. I'll look into updating macro for this case separately.
There was a problem hiding this comment.
Yes, extending #[estree(append_to = ...)] to cover appending Vecs too would be ideal. We could alternatively add #[estree(prepend_to = ...)], which would make more sense here. But I think for now we already have enough attributes - probably better to use append_to at least for now.
Let me know if you have trouble working out how to adapt the codegen. I think it mostly makes sense, but I wrote it, so of course it makes sense to me!
e5ab419 to
161ebd1
Compare
840c440 to
4803059
Compare
161ebd1 to
2315309
Compare
overlookmotel
left a comment
There was a problem hiding this comment.
Great!
Side note: I'm wondering in what circumstances the expression field is true?
Seems not to be true for function expressions (AST explorer). So when is it true? I guess we'll find out as we progress through the test cases...
Merge activity
|
2315309 to
a2883b1
Compare
I just looked into estree and this is probably for some ancient deprecated feature https://github.com/estree/estree/blob/2b48e56efc223ea477a45b5e034039934c5791fa/deprecated.md#functions In https://bugzilla.mozilla.org/show_bug.cgi?id=1083458, I found a weird syntax like |
Ah ha! |
Part of #2854 Related: #8972 (comment) I updated `append_to` macro to support concatenating two `Vec`. The logic is very similar so I reused it, but maybe it's better to introduce a new macro or maybe rename `append_to`?

Part of #2854
diff of estree_test262.snap