Skip to content

Fix handling of aruments in the emitter #38880

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

Merged
merged 2 commits into from
Jun 13, 2020
Merged

Conversation

elibarzilay
Copy link
Contributor

@elibarzilay elibarzilay commented Jun 1, 2020

Two problems are fixed:

  • isArgumentsLocalBinding did only PropertyAccessExpression, now it's also doing PropertyAssignment (doesn't affect other files, since it's only used in the emitter).

  • visitShorthandPropertyAssignment should call visitIdentifier on the synthesized id. (For completion it might be better to make it visit the the original?)

Fixes #38594.

Also, simplify visitObjectLiteralExpression (I ran into it and the comment at the top tripped me, then I proceeded to simplify the code. Patched a bit more of the function to make sure that the indentation doesn't change, and added tests.) This is in a separate commit since it's only loosely related.

Two problems are fixed:

* `isArgumentsLocalBinding` did only `PropertyAccessExpression`, now
  it's also doing `PropertyAssignment` (doesn't affect other files,
  since it's only used in the emitter).

* `visitShorthandPropertyAssignment` should call `visitIdentifier` on
  the synthesized id.  (For completion it might be better to make it
  visit the the original?)

Fixes microsoft#38594.
I ran into it and the comment at the top tripped me, then I proceeded to
simplify the code.  Patched a bit more of the function to make sure that
the indentation doesn't change, and added tests.
switch (_c.label) {
case 0:
_b = {
a: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still seem to have excess indentation. At this point it doesn't seem worth the extra time to keep digging into this. We can just remove the hasComputed check and possibly come back to it later.

Copy link
Contributor

@rbuckton rbuckton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its up to you if you want to remove the hasComputed check since there are too many corner cases it doesn't solve and at this point its not worth the extra time to dig into them.

@elibarzilay elibarzilay merged commit 8231519 into microsoft:master Jun 13, 2020
@elibarzilay elibarzilay deleted the 38594 branch June 13, 2020 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"arguments" incorrectly munged to "arguments_1" in numerous circumstances in a for loop targeting ES5
4 participants