Skip to content

ignore trailing newline tokens#2120

Merged
fubuloubu merged 1 commit into
vyperlang:masterfrom
iamdefinitelyahuman:fix-offsets
Jul 26, 2020
Merged

ignore trailing newline tokens#2120
fubuloubu merged 1 commit into
vyperlang:masterfrom
iamdefinitelyahuman:fix-offsets

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

When calculating the end offset for AST nodes, ignore trailing newlines.

How I did it

In some cases the final token given for an AST node is type 4, which is \n. This makes for a weird source offset, and under very specific conditions is causing issues in Brownie.

To fix it, I'm checking if the final token is \n and if yes: -1 from the given offset.

How to verify it

Run tests.

Cute Animal Picture

image

@fubuloubu fubuloubu merged commit 4c08391 into vyperlang:master Jul 26, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-offsets branch July 26, 2020 21:52
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