Skip to content

Add return statement to the JIT AST#5578

Merged
apaszke merged 2 commits intomasterfrom
jit_ast_return
Mar 6, 2018
Merged

Add return statement to the JIT AST#5578
apaszke merged 2 commits intomasterfrom
jit_ast_return

Conversation

@apaszke
Copy link
Copy Markdown
Contributor

@apaszke apaszke commented Mar 5, 2018

This also makes the syntax recognized by the parser compatible with Python syntax, so it will allow us to reuse Python functions for script tests as well.

Copy link
Copy Markdown
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

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

Looks good! one minor question

Comment thread torch/csrc/jit/script/parser.h Outdated
return c(TK_GLOBAL, range, std::move(idents));
auto idents = parseList(TK_NOTHING, ',', TK_NOTHING, &Parser::parseIdent);
if (idents.empty())
throw ErrorReport(range) << "global statement needs a list of variable names";

This comment was marked as off-topic.

This comment was marked as off-topic.

@apaszke
Copy link
Copy Markdown
Contributor Author

apaszke commented Mar 6, 2018

Fixed the comment and changed all uses of TK_OPTION to TK_NOTHING. They have been used to denote similar things, but saying that a list ends with TK_OPTION is weird.

@apaszke apaszke merged commit 5597aba into master Mar 6, 2018
// Now we *may* have an expression.
if (L.cur().kind != ']') {
second = c(TK_OPTION, range, {parseExp()});
second = c(TK_NOTHING, range, {parseExp()});

This comment was marked as off-topic.

This comment was marked as off-topic.

@apaszke apaszke deleted the jit_ast_return branch May 18, 2018 09:02
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants