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

redo and next should raise a SyntaxError in methods #3058

Open
eregon opened this issue Jun 16, 2015 · 4 comments
Open

redo and next should raise a SyntaxError in methods #3058

eregon opened this issue Jun 16, 2015 · 4 comments
Assignees

Comments

@eregon
Copy link
Member

eregon commented Jun 16, 2015

See dcb41d0 and the 2 previous commits.

Should it be done in the parser? (and is it reasonable?)
It seems MRI does it slightly later as -c or Ripper will not catch it for instance.

@enebo
Copy link
Member

enebo commented Jun 16, 2015

@eregon We do not have parent links between node in AST so I think this is more easily done after parsing but I don't want the parser to walk the tree after making it to look for this condition (it would slow startup to re-walk each tree). This means both Truffle and IR should detect this during the assembling their respective intermediate forms. This is a little duplication but can be done when naturally walking the tree to build our IRs.

@enebo
Copy link
Member

enebo commented Jun 16, 2015

@eregon I guess we could do a subtree visit on DefnNode creation but it still feels like an extra traversal of part of the tree.

@eregon
Copy link
Member Author

eregon commented Jun 16, 2015

@enebo Sounds reasonable, I actually implemented it in Truffle translator.
I was wondering whether the parser has the knowledge if it is within a block/method or not. I agree an extra traversal is not worth for this, it can be dealt with later easily.

@enebo
Copy link
Member

enebo commented Jun 17, 2015

@eregon At the time we are creating the node we have no up-pointing references to higher scope types (e.g. begin, def{sn}, module,class, etc...) so we need to walk from scopes down to look for the redo/next. We create staticScopes but they have no back references so that is not usable either.

@kares kares changed the title redo and next should raise a SynaxError in methods redo and next should raise a SyntaxError in methods Jul 21, 2015
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

No branches or pull requests

2 participants