Skip to content

Commit

Permalink
Add subscripts to callable types
Browse files Browse the repository at this point in the history
  • Loading branch information
advikkabra committed Jun 17, 2024
1 parent 2420448 commit 4c5396a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7733,6 +7733,17 @@ we will have to use something else.
}
handle_builtin_attribute(dict_expr, at->m_attr, loc, eles);
return;
} else if (AST::is_a<AST::Subscript_t>(*at->m_value)) {
AST::Subscript_t *s = AST::down_cast<AST::Subscript_t>(at->m_value);
visit_Subscript(*s);
ASR::expr_t *subscript_expr = ASR::down_cast<ASR::expr_t>(tmp);
Vec<ASR::expr_t*> eles;
eles.reserve(al, args.size());
for (size_t i = 0; i < args.size(); i++) {
eles.push_back(al, args[i].m_value);
}
handle_builtin_attribute(subscript_expr, at->m_attr, loc, eles);
return;
} else {
throw SemanticError("Only Name type and constant integers supported in Call", loc);
}
Expand Down

0 comments on commit 4c5396a

Please sign in to comment.