Skip to content

Commit ba76069

Browse files
authored
Merge pull request #2035 from arteevraina/internal-function-def
fix: internal function def errors
2 parents e8f63b0 + 0d85df3 commit ba76069

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4761,6 +4761,12 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
47614761
void visit_FunctionDef(const AST::FunctionDef_t &x) {
47624762
SymbolTable *old_scope = current_scope;
47634763
ASR::symbol_t *t = current_scope->get_symbol(x.m_name);
4764+
4765+
if (t == nullptr) {
4766+
// Throw Not implemented error.
4767+
throw SemanticError("Internal FunctionDef: Not implemented", x.base.base.loc);
4768+
}
4769+
47644770
if (ASR::is_a<ASR::Function_t>(*t)) {
47654771
ASR::Function_t *f = ASR::down_cast<ASR::Function_t>(t);
47664772
if (!ASRUtils::get_FunctionType(f)->m_is_restriction) {

0 commit comments

Comments
 (0)