Skip to content
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

+ ruby27.y: fix array pattern with tail source map #659

Merged
merged 1 commit into from Mar 20, 2020

Conversation

palkan
Copy link
Contributor

@palkan palkan commented Mar 20, 2020

This change takes trailing comman into account for array_pattern_with_tail expression location:

# before
in foo,
   ~~~ expression

# after
in foo,
   ~~~~ expression

Currently, we lose comma location information, which makes it hard for rewriters to deal with this case.

This change takes trailing comman into account for array_pattern_with_tail expression location
@palkan
Copy link
Contributor Author

palkan commented Mar 20, 2020

@iliabylich Another source map related question I would like to ask about first: what is the reason for the existing const_pattern behavior with expression to not including the const itself?

in A[0,1]
    ~~~~~ expression (in_pattern.const_pattern)
   ~ expression (in_pattern.const_pattern.const)

Do we already have such examples when a child node's expression is located outside of the parent node?

@palkan palkan changed the title Fix source map for array pattern with tai Fix source map for array pattern with tail Mar 20, 2020
@iliabylich
Copy link
Collaborator

Do we already have such examples when a child node's expression is located outside of the parent node?

No, that's a bug. Could you send a PR to fix it please? If not I'll find some time next week.

Copy link
Collaborator

@iliabylich iliabylich left a comment

Choose a reason for hiding this comment

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

LGTM

@iliabylich iliabylich changed the title Fix source map for array pattern with tail + ruby27.y: fix array pattern with tail source map Mar 20, 2020
@iliabylich iliabylich merged commit 5610352 into whitequark:master Mar 20, 2020
@palkan
Copy link
Contributor Author

palkan commented Mar 20, 2020

Could you send a PR to fix it please?

Sure.

@palkan palkan deleted the fix/pattern-matching-locs branch March 20, 2020 16:31
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.

None yet

2 participants