-
Notifications
You must be signed in to change notification settings - Fork 163
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
Implemented visit_AsyncFunctionDef in the AST->ASR visitor #2442
Conversation
try | ||
{ | ||
// to be implemented | ||
} | ||
catch(const std::exception& e) | ||
{ | ||
std::cerr << e.what() << '\n'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to report the error like this:
try | |
{ | |
// to be implemented | |
} | |
catch(const std::exception& e) | |
{ | |
std::cerr << e.what() << '\n'; | |
} | |
throw SemanticError("The `async` keyword is currently not supported", x.base.base.loc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @certik. I will make the necessary changes
std::cerr << e.what() << '\n'; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of declaring it twice, declare it just once in the base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function completely.
Let's also add a test for this in |
@certik , can you please guide me a bit on how to add the test for the async implementation in tests/errors. I have created the file
But when I run ./run_tests.py, the file doesn't get executed. |
You have to add it to |
try | ||
{ | ||
// to be implemented | ||
} | ||
catch(const std::exception& e) | ||
{ | ||
std::cerr << e.what() << '\n'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these.
std::cerr << e.what() << '\n'; | ||
} | ||
throw SemanticError("The `async` keyword is currently not supported", x.base.base.loc); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the function to the CommonVisitor
.
Very good, it's almost done. Left couple more comments. |
@@ -4051,6 +4056,8 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> { | |||
// Implement visit_Global for Symbol Table visitor. | |||
void visit_Global(const AST::Global_t &/*x*/) {} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove white space.
@@ -4823,6 +4830,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> { | |||
tmp = nullptr; | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove white space
It looks good! Last two issues, see my comments above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great now, thank you!
…unctionDef function from BodyVisitor and moved the function to common visitor
Solves issue no #2312. Implemented visit_AsyncFunctionDef function both in the SymbolTableVisitor and BodyVisitor class.