Skip to content

Fix for symbol detection when nested method #491

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 4 commits into from
Aug 29, 2017

Conversation

aycabta
Copy link
Member

@aycabta aycabta commented Aug 12, 2017

When nested method as identifer detected, @lex_state is :EXPR_MID and it becomes :EXPR_END. However, in : token processing, TkSYMBEG is generated only when @lex_state is not :EXPR_END. So symbol for nested method becomes TkCOLON as distinct from TkSYMBEG.

This Pull Request fixes the behavior.

Before:

before

The symbol, :name, it consists TkCOLON and TkIDENTIFIER.

After(fixed):

after(fixed)

The :name is a symbol.

When nested method as identifer detected,
@lex_state is :EXPR_MID and it becomes :EXPR_END.
However, in ":" token processing,
TkSYMBEG is generated
only when @lex_state is not :EXPR_END.
So symbol for nested method becomes TkCOLON
as distinct from TkSYMBEG.
This commit fixes the behavior.
@hsbt hsbt self-assigned this Aug 15, 2017
@@ -789,28 +789,16 @@ def test_class_tokenize_symbol
assert_equal expected, tokens
end

def test_class_tokenize_particular_kind_of_symbols
Copy link
Member

@hsbt hsbt Aug 23, 2017

Choose a reason for hiding this comment

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

Is it a regression?

test_class_tokenize_particular_kind_of_symbols is still working test case.

@aycabta aycabta force-pushed the fix-for-symbol-detection-when-nested-method branch from f465519 to a95c755 Compare August 23, 2017 04:38
@aycabta
Copy link
Member Author

aycabta commented Aug 23, 2017

I fixed merging what is handled yesterday. Haste makes waste...

@hsbt
Copy link
Member

hsbt commented Aug 29, 2017

Thanks. Looks reasonable.

@hsbt hsbt merged commit 6cfcae2 into ruby:master Aug 29, 2017
@aycabta aycabta deleted the fix-for-symbol-detection-when-nested-method branch August 29, 2017 06:22
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.

2 participants