Skip to content
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

Changes from lfortran #2326

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix reference to derived_type_sym in FunctionType
  • Loading branch information
Shaikh-Ubaid committed Sep 16, 2023
commit 12a376a1c7ed03460f545e448dab7b2d07287085
2 changes: 2 additions & 0 deletions src/libasr/asdl_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,8 @@ def visitField(self, field):
self.emit(" self().replace_expr(x->m_%s[i]);"%(field.name), level)
self.emit(" current_expr = current_expr_copy_%d;" % (self.current_expr_copy_variable_count), level)
self.current_expr_copy_variable_count += 1
elif field.type == "ttype":
self.emit(" self().replace_%s(x->m_%s[i]);" % (field.type, field.name), level)
self.emit("}", level)
else:
if field.type != "symbol":
Expand Down
10 changes: 10 additions & 0 deletions src/libasr/asr_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3277,6 +3277,16 @@ class ReplaceWithFunctionParamVisitor: public ASR::BaseExprReplacer<ReplaceWithF
}
}

void replace_Struct(ASR::Struct_t *x) {
std::string derived_type_name = ASRUtils::symbol_name(x->m_derived_type);
ASR::symbol_t* derived_type_sym = current_scope->resolve_symbol(derived_type_name);
LCOMPILERS_ASSERT_MSG( derived_type_sym != nullptr,
"derived_type_sym cannot be nullptr");
if (derived_type_sym != x->m_derived_type) {
x->m_derived_type = derived_type_sym;
}
}

ASR::ttype_t* replace_args_with_FunctionParam(ASR::ttype_t* t, SymbolTable* current_scope) {
this->current_scope = current_scope;

Expand Down