Skip to content

Commit

Permalink
removed unnecessary lines from the function, removed the visit_AsyncF…
Browse files Browse the repository at this point in the history
…unctionDef function from BodyVisitor and moved the function to common visitor
  • Loading branch information
ujjwaltwitx authored and certik committed Dec 14, 2023
1 parent 0f4dc32 commit 3ee163e
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
return nullptr;
}


void visit_AsyncFunctionDef(const AST::AsyncFunctionDef_t &x){
throw SemanticError("The `async` keyword is currently not supported", x.base.base.loc);
}

void visit_expr_list(AST::expr_t** exprs, size_t n,
Vec<ASR::expr_t*>& exprs_vec) {
LCOMPILERS_ASSERT(exprs_vec.reserve_called);
Expand Down Expand Up @@ -4051,17 +4056,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
// Implement visit_Global for Symbol Table visitor.
void visit_Global(const AST::Global_t &/*x*/) {}

void visit_AsyncFunctionDef(const AST::AsyncFunctionDef_t &x){
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);
}


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

void visit_AsyncFunctionDef(const AST::AsyncFunctionDef_t &/*x*/) {
try
{
// BodyVisitor for visit_AsyncFunctionDef to be implemented
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
}

}


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

0 comments on commit 3ee163e

Please sign in to comment.