Closed disnet closed 7 years ago
Should we be doing this in more places where we test for a specific keyword? enforestExportDeclaration
for instance.
If default
is bound to a macro, the transform isn't going to take place. There are a couple of places in enforestLeftHandSideExpression
where this could be an issue as well.
Good call. I've updated the PR, let me know any place else I've missed.
But then we have the question: how atomic is an enforestation?
This is deep in the enforestation of a SwitchStatement
.
Thanks for catching those. I think the ones in enforestAssignmentExpression
and enforestStatement
were technically "fine" because macros in the position are completely expanded before reaching the check, however doing the transform check is more correct anyway.
The one deep in the switch statement was a bug, if class
was bound to a macro it needed to fall through to enforestStatement
which triggers macro expansion.
Found a few more: https://github.com/sweet-js/sweet.js/blob/678709944272837750117b86d1fe53127c36c6b0/src/enforester.js#L453 https://github.com/sweet-js/sweet.js/blob/678709944272837750117b86d1fe53127c36c6b0/src/enforester.js#L1246 https://github.com/sweet-js/sweet.js/blob/678709944272837750117b86d1fe53127c36c6b0/src/enforester.js#L1347
These would be purely for correctness though.
Allows macros to bind on the import and export keywords. Previously this was an error: