Skip to content

Cleanup#1

Closed
GeoffreyBooth wants to merge 8 commits intoatg:masterfrom
GeoffreyBooth:for-from
Closed

Cleanup#1
GeoffreyBooth wants to merge 8 commits intoatg:masterfrom
GeoffreyBooth:for-from

Conversation

@GeoffreyBooth
Copy link

Addresses the lexer if block, general cleanup for style.

I’m leaving for you the task of moving the compilation error tests into error_messages.coffee.

alangpierce and others added 2 commits October 30, 2016 21:39
This is an upstream port of decaffeinate#10
See that PR for links to the issues that this fixes.

Just like OUTDENT and CALL_END tokens, close-curly-brace tokens can be generated
without having a real location, and if that position overlaps with a later
token, it can cause the AST to have bad location data. Just like the other two
token types, we now give `}` tokens the position of the previous real token,
which makes all AST nodes have reasonable locations.
…ated-close-curly-location

Include generated } tokens when fixing closing token positions
src/lexer.coffee Outdated
if @value() is '!'
poppedToken = @tokens.pop()
id = '!' + id
else if id is 'from' and @seenFor
Copy link
Owner

Choose a reason for hiding this comment

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

Won't this break if tag is 'PROPERTY'?

Copy link
Author

Choose a reason for hiding this comment

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

You should add a test for that :) This change didn't break any tests.

If it needs that check, I would just change this to else if tag is 'IDENTIFIER' and id is 'from' and @seenFor

@lydell lydell deleted the for-from branch November 8, 2016 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants