@@ -1003,8 +1003,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1003
1003
}
1004
1004
}
1005
1005
1006
- ASR::expr_t * process_attributes (Allocator &al, const Location &loc, ASR::expr_t * expr,
1007
- SymbolTable* module_scope) {
1006
+ ASR::expr_t * process_attributes (const Location &loc, ASR::expr_t * expr) {
1008
1007
if (ASR::is_a<ASR::IntrinsicScalarFunction_t>(*expr)) {
1009
1008
ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast<ASR::IntrinsicScalarFunction_t>(expr);
1010
1009
int64_t intrinsic_id = intrinsic_func->m_intrinsic_id ;
@@ -1031,7 +1030,6 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1031
1030
}
1032
1031
1033
1032
void visit_Assignment (const ASR::Assignment_t &x) {
1034
- SymbolTable* module_scope = current_scope->parent ;
1035
1033
if (ASR::is_a<ASR::Var_t>(*x.m_value ) && ASR::is_a<ASR::CPtr_t>(*ASRUtils::expr_type (x.m_value ))) {
1036
1034
ASR::symbol_t *v = ASR::down_cast<ASR::Var_t>(x.m_value )->m_v ;
1037
1035
if (symbolic_vars_to_free.find (v) == symbolic_vars_to_free.end ()) return ;
@@ -1043,7 +1041,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1043
1041
if (intrinsic_func->m_type ->type == ASR::ttypeType::SymbolicExpression) {
1044
1042
process_intrinsic_function (x.base .base .loc , intrinsic_func, x.m_target );
1045
1043
} else if (intrinsic_func->m_type ->type == ASR::ttypeType::Logical) {
1046
- ASR::expr_t * function_call = process_attributes (al, x.base .base .loc , x.m_value , module_scope );
1044
+ ASR::expr_t * function_call = process_attributes (x.base .base .loc , x.m_value );
1047
1045
ASR::stmt_t * stmt = ASRUtils::STMT (ASR::make_Assignment_t (al, x.base .base .loc , x.m_target , function_call, nullptr ));
1048
1046
pass_result.push_back (al, stmt);
1049
1047
}
@@ -1129,11 +1127,10 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1129
1127
ASR::If_t& xx = const_cast <ASR::If_t&>(x);
1130
1128
transform_stmts (xx.m_body , xx.n_body );
1131
1129
transform_stmts (xx.m_orelse , xx.n_orelse );
1132
- SymbolTable* module_scope = current_scope->parent ;
1133
1130
if (ASR::is_a<ASR::IntrinsicScalarFunction_t>(*xx.m_test )) {
1134
1131
ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast<ASR::IntrinsicScalarFunction_t>(xx.m_test );
1135
1132
if (intrinsic_func->m_type ->type == ASR::ttypeType::Logical) {
1136
- ASR::expr_t * function_call = process_attributes (al, xx.base .base .loc , xx.m_test , module_scope );
1133
+ ASR::expr_t * function_call = process_attributes (xx.base .base .loc , xx.m_test );
1137
1134
xx.m_test = function_call;
1138
1135
}
1139
1136
}
@@ -1190,7 +1187,6 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1190
1187
1191
1188
void visit_Print (const ASR::Print_t &x) {
1192
1189
std::vector<ASR::expr_t *> print_tmp;
1193
- SymbolTable* module_scope = current_scope->parent ;
1194
1190
for (size_t i=0 ; i<x.n_values ; i++) {
1195
1191
ASR::expr_t * val = x.m_values [i];
1196
1192
if (ASR::is_a<ASR::Var_t>(*val) && ASR::is_a<ASR::CPtr_t>(*ASRUtils::expr_type (val))) {
@@ -1220,7 +1216,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1220
1216
// Now create the FunctionCall node for basic_str
1221
1217
print_tmp.push_back (basic_str (x.base .base .loc , target));
1222
1218
} else if (ASR::is_a<ASR::Logical_t>(*ASRUtils::expr_type (val))) {
1223
- ASR::expr_t * function_call = process_attributes (al, x.base .base .loc , val, module_scope );
1219
+ ASR::expr_t * function_call = process_attributes (x.base .base .loc , val);
1224
1220
print_tmp.push_back (function_call);
1225
1221
}
1226
1222
} else if (ASR::is_a<ASR::Cast_t>(*val)) {
@@ -1358,14 +1354,13 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1358
1354
}
1359
1355
1360
1356
void visit_Assert (const ASR::Assert_t &x) {
1361
- SymbolTable* module_scope = current_scope->parent ;
1362
1357
ASR::expr_t * left_tmp = nullptr ;
1363
1358
ASR::expr_t * right_tmp = nullptr ;
1364
1359
if (ASR::is_a<ASR::LogicalCompare_t>(*x.m_test )) {
1365
1360
ASR::LogicalCompare_t *l = ASR::down_cast<ASR::LogicalCompare_t>(x.m_test );
1366
1361
1367
- left_tmp = process_attributes (al, x.base .base .loc , l->m_left , module_scope );
1368
- right_tmp = process_attributes (al, x.base .base .loc , l->m_right , module_scope );
1362
+ left_tmp = process_attributes (x.base .base .loc , l->m_left );
1363
+ right_tmp = process_attributes (x.base .base .loc , l->m_right );
1369
1364
ASR::expr_t * test = ASRUtils::EXPR (ASR::make_LogicalCompare_t (al, x.base .base .loc , left_tmp,
1370
1365
l->m_op , right_tmp, l->m_type , l->m_value ));
1371
1366
@@ -1386,7 +1381,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
1386
1381
} else if (ASR::is_a<ASR::IntrinsicScalarFunction_t>(*x.m_test )) {
1387
1382
ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast<ASR::IntrinsicScalarFunction_t>(x.m_test );
1388
1383
if (intrinsic_func->m_type ->type == ASR::ttypeType::Logical) {
1389
- ASR::expr_t * test = process_attributes (al, x.base .base .loc , x.m_test , module_scope );
1384
+ ASR::expr_t * test = process_attributes (x.base .base .loc , x.m_test );
1390
1385
ASR::stmt_t *assert_stmt = ASRUtils::STMT (ASR::make_Assert_t (al, x.base .base .loc , test, x.m_msg ));
1391
1386
pass_result.push_back (al, assert_stmt);
1392
1387
}
0 commit comments