@@ -23,7 +23,6 @@ class ReplaceStructTypeConstructor: public ASR::BaseExprReplacer<ReplaceStructTy
23
23
Vec<ASR::stmt_t *>& pass_result;
24
24
bool & remove_original_statement;
25
25
bool & inside_symtab;
26
- bool & apply_again;
27
26
std::map<SymbolTable*, Vec<ASR::stmt_t *>>& symtab2decls;
28
27
29
28
public:
@@ -32,13 +31,12 @@ class ReplaceStructTypeConstructor: public ASR::BaseExprReplacer<ReplaceStructTy
32
31
ASR::expr_t * result_var;
33
32
34
33
ReplaceStructTypeConstructor (Allocator& al_, Vec<ASR::stmt_t *>& pass_result_,
35
- bool & remove_original_statement_, bool & inside_symtab_, bool & apply_again_,
34
+ bool & remove_original_statement_, bool & inside_symtab_,
36
35
std::map<SymbolTable*, Vec<ASR::stmt_t *>>& symtab2decls_) :
37
36
al (al_), pass_result(pass_result_),
38
37
remove_original_statement (remove_original_statement_),
39
- inside_symtab (inside_symtab_), apply_again(apply_again_),
40
- symtab2decls (symtab2decls_), current_scope(nullptr ),
41
- result_var (nullptr ) {}
38
+ inside_symtab (inside_symtab_), symtab2decls(symtab2decls_),
39
+ current_scope (nullptr ), result_var(nullptr ) {}
42
40
43
41
void replace_StructTypeConstructor (ASR::StructTypeConstructor_t* x) {
44
42
if ( x->n_args == 0 ) {
@@ -133,7 +131,6 @@ class StructTypeConstructorVisitor : public ASR::CallReplacerOnExpressionsVisito
133
131
Allocator& al;
134
132
bool remove_original_statement;
135
133
bool inside_symtab;
136
- bool apply_again;
137
134
ReplaceStructTypeConstructor replacer;
138
135
Vec<ASR::stmt_t *> pass_result;
139
136
std::map<SymbolTable*, Vec<ASR::stmt_t *>> symtab2decls;
@@ -142,10 +139,9 @@ class StructTypeConstructorVisitor : public ASR::CallReplacerOnExpressionsVisito
142
139
143
140
StructTypeConstructorVisitor (Allocator& al_) :
144
141
al (al_), remove_original_statement(false ),
145
- inside_symtab (true ), apply_again(false ),
146
- replacer (al_, pass_result,
142
+ inside_symtab (true ), replacer(al_, pass_result,
147
143
remove_original_statement, inside_symtab,
148
- apply_again, symtab2decls) {
144
+ symtab2decls) {
149
145
pass_result.n = 0 ;
150
146
pass_result.reserve (al, 0 );
151
147
}
@@ -173,7 +169,6 @@ class StructTypeConstructorVisitor : public ASR::CallReplacerOnExpressionsVisito
173
169
for (size_t i = 0 ; i < n_body; i++) {
174
170
pass_result.n = 0 ;
175
171
pass_result.reserve (al, 1 );
176
- apply_again = false ;
177
172
remove_original_statement = false ;
178
173
replacer.result_var = nullptr ;
179
174
visit_stmt (*m_body[i]);
@@ -225,6 +220,8 @@ void pass_replace_class_constructor(Allocator &al,
225
220
const LCompilers::PassOptions& /* pass_options*/ ) {
226
221
StructTypeConstructorVisitor v (al);
227
222
v.visit_TranslationUnit (unit);
223
+ PassUtils::UpdateDependenciesVisitor w (al);
224
+ w.visit_TranslationUnit (unit);
228
225
}
229
226
230
227
0 commit comments