Skip to content

Commit 3ee163e

Browse files
ujjwaltwitxcertik
authored andcommitted
removed unnecessary lines from the function, removed the visit_AsyncFunctionDef function from BodyVisitor and moved the function to common visitor
1 parent 0f4dc32 commit 3ee163e

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,11 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
592592
return nullptr;
593593
}
594594

595+
596+
void visit_AsyncFunctionDef(const AST::AsyncFunctionDef_t &x){
597+
throw SemanticError("The `async` keyword is currently not supported", x.base.base.loc);
598+
}
599+
595600
void visit_expr_list(AST::expr_t** exprs, size_t n,
596601
Vec<ASR::expr_t*>& exprs_vec) {
597602
LCOMPILERS_ASSERT(exprs_vec.reserve_called);
@@ -4051,17 +4056,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
40514056
// Implement visit_Global for Symbol Table visitor.
40524057
void visit_Global(const AST::Global_t &/*x*/) {}
40534058

4054-
void visit_AsyncFunctionDef(const AST::AsyncFunctionDef_t &x){
4055-
try
4056-
{
4057-
// to be implemented
4058-
}
4059-
catch(const std::exception& e)
4060-
{
4061-
std::cerr << e.what() << '\n';
4062-
}
4063-
throw SemanticError("The `async` keyword is currently not supported", x.base.base.loc);
4064-
}
4059+
40654060

40664061
void visit_FunctionDef(const AST::FunctionDef_t &x) {
40674062
dependencies.clear(al);
@@ -4835,18 +4830,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
48354830
tmp = nullptr;
48364831
}
48374832

4838-
void visit_AsyncFunctionDef(const AST::AsyncFunctionDef_t &/*x*/) {
4839-
try
4840-
{
4841-
// BodyVisitor for visit_AsyncFunctionDef to be implemented
4842-
}
4843-
catch(const std::exception& e)
4844-
{
4845-
std::cerr << e.what() << '\n';
4846-
}
4847-
4848-
}
4849-
48504833

48514834
void visit_Import(const AST::Import_t &x) {
48524835
// All the modules are imported in the SymbolTable visitor

0 commit comments

Comments
 (0)