Skip to content

Commit 11922e8

Browse files
committed
REF: StructTypw util return type
1 parent f76c58d commit 11922e8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
572572
} else {
573573
sym = es_s;
574574
}
575-
return ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, sym));
575+
return ASRUtils::make_StructType_t_util(al, loc, sym);
576576
}
577577
default: {
578578
return return_type;
@@ -841,7 +841,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
841841
ASR::symbol_t *der_sym = ASRUtils::symbol_get_past_external(s);
842842
if( der_sym ) {
843843
if ( ASR::is_a<ASR::Struct_t>(*der_sym) ) {
844-
type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, s));
844+
type = ASRUtils::make_StructType_t_util(al, loc, s);
845845
type = ASRUtils::make_Array_t_util(al, loc, type, dims.p, dims.size(), abi, is_argument);
846846
} else if( ASR::is_a<ASR::Enum_t>(*der_sym) ) {
847847
type = ASRUtils::TYPE(ASR::make_EnumType_t(al, loc, s));
@@ -1307,7 +1307,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
13071307
if ( n_kwargs>0 ) {
13081308
throw SemanticError("Keyword args are not supported", loc);
13091309
}
1310-
ASR::ttype_t* der_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, stemp));
1310+
ASR::ttype_t* der_type = ASRUtils::make_StructType_t_util(al, loc, stemp);
13111311
return ASR::make_StructConstructor_t(al, loc, stemp, args.p,
13121312
args.size(), der_type, nullptr);
13131313
}
@@ -1342,7 +1342,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
13421342
for (size_t i = args.size(); i < st->n_members; i++) {
13431343
args.push_back(al, st->m_initializers[i]);
13441344
}
1345-
ASR::ttype_t* der_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, stemp));
1345+
ASR::ttype_t* der_type = ASRUtils::make_StructType_t_util(al, loc, stemp);
13461346
return ASR::make_StructConstructor_t(al, loc, stemp, args.p, args.size(), der_type, nullptr);
13471347
} else if( ASR::is_a<ASR::Enum_t>(*s) ) {
13481348
Vec<ASR::expr_t*> args_new;
@@ -1955,7 +1955,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
19551955
" str annotation", loc);
19561956
}
19571957
//TODO: Change the returned type from Class to StructType
1958-
return ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, sym, false));
1958+
return ASRUtils::make_StructType_t_util(al, loc, sym, false);
19591959
}
19601960

19611961
throw SemanticError("Only Name, Subscript, and Call supported for now in annotation of annotated assignment.", loc);
@@ -3485,7 +3485,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
34853485
std::string self_name = x.m_args.m_args[0].m_arg;
34863486
ASR::symbol_t* sym = current_scope->get_symbol(self_name);
34873487
ASR::Variable_t* self_var = ASR::down_cast<ASR::Variable_t>(sym);
3488-
self_var->m_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al,loc, class_sym));
3488+
self_var->m_type = ASRUtils::make_StructType_t_util(al,loc, class_sym);
34893489
current_scope = parent_scope;
34903490
}
34913491

@@ -5361,7 +5361,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
53615361
first_arg.loc = loc;
53625362
ASR::symbol_t* self_sym = current_scope->get_symbol("self");
53635363
first_arg.m_value = ASRUtils::EXPR(ASR::make_Var_t(al,loc,self_sym));
5364-
ASR::ttype_t* target_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al,loc,parent_sym));
5364+
ASR::ttype_t* target_type = ASRUtils::make_StructType_t_util(al,loc,parent_sym);
53655365
cast_helper(target_type, first_arg.m_value, x.base.base.loc, true);
53665366
Vec<ASR::call_arg_t> args_w_first; args_w_first.reserve(al,1);
53675367
args_w_first.push_back(al, first_arg);
@@ -6354,7 +6354,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
63546354
s2c(al, struct_member_name), ASR::accessType::Public));
63556355
current_scope->add_symbol(import_name, import_struct_member);
63566356
}
6357-
member_var_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, import_struct_member));
6357+
member_var_type = ASRUtils::make_StructType_t_util(al, loc, import_struct_member);
63586358
}
63596359
}
63606360
}
@@ -6458,7 +6458,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
64586458
" found in " + std::string(der_type->m_name),
64596459
loc);
64606460
} else if ( !member_found && der_type->m_parent ) {
6461-
ASR::ttype_t* parent_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc,der_type->m_parent));
6461+
ASR::ttype_t* parent_type = ASRUtils::make_StructType_t_util(al, loc,der_type->m_parent);
64626462
visit_AttributeUtil(parent_type,attr_char,t,loc);
64636463
return;
64646464
}
@@ -6495,7 +6495,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
64956495
s2c(al, struct_member_name), ASR::accessType::Public));
64966496
current_scope->add_symbol(import_name, import_struct_member);
64976497
}
6498-
member_var_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, import_struct_member));
6498+
member_var_type = ASRUtils::make_StructType_t_util(al, loc, import_struct_member);
64996499
}
65006500
}
65016501
}

0 commit comments

Comments
 (0)