Revision 0f36882c src/modules.ml
src/modules.ml | ||
---|---|---|
154 | 154 |
) |
155 | 155 |
|
156 | 156 |
let rec load_header_rec imported header = |
157 |
List.fold_left (fun imp decl -> |
|
157 |
List.fold_left (fun imported decl ->
|
|
158 | 158 |
match decl.top_decl_desc with |
159 | 159 |
| Node nd -> assert false |
160 |
| ImportedNode ind -> (add_imported_node ind.nodei_id decl; imp) |
|
161 |
| Const c -> (add_const true c.const_id decl; imp) |
|
162 |
| TypeDef tdef -> (add_type true tdef.tydef_id decl; imp) |
|
160 |
| ImportedNode ind -> (add_imported_node ind.nodei_id decl; imported)
|
|
161 |
| Const c -> (add_const true c.const_id decl; imported)
|
|
162 |
| TypeDef tdef -> (add_type true tdef.tydef_id decl; imported)
|
|
163 | 163 |
| Open (local, dep) -> |
164 | 164 |
let basename = name_dependency (local, dep) in |
165 |
if ISet.mem basename imported then imp else |
|
165 |
if ISet.mem basename imported then imported else
|
|
166 | 166 |
let lusic = import_dependency_aux decl.top_decl_loc (local, dep) |
167 | 167 |
in load_header_rec (ISet.add basename imported) lusic.Lusic.contents |
168 | 168 |
) imported header |
... | ... | |
179 | 179 |
);; |
180 | 180 |
|
181 | 181 |
let rec load_program_rec imported program = |
182 |
List.fold_left (fun imp decl -> |
|
182 |
List.fold_left (fun imported decl ->
|
|
183 | 183 |
match decl.top_decl_desc with |
184 |
| Node nd -> (add_node nd.node_id decl; imp) |
|
184 |
| Node nd -> (add_node nd.node_id decl; imported)
|
|
185 | 185 |
| ImportedNode ind -> assert false |
186 |
| Const c -> (add_const false c.const_id decl; imp) |
|
187 |
| TypeDef tdef -> (add_type false tdef.tydef_id decl; imp) |
|
186 |
| Const c -> (add_const false c.const_id decl; imported)
|
|
187 |
| TypeDef tdef -> (add_type false tdef.tydef_id decl; imported)
|
|
188 | 188 |
| Open (local, dep) -> |
189 | 189 |
let basename = name_dependency (local, dep) in |
190 |
if ISet.mem basename imported then imp else |
|
190 |
if ISet.mem basename imported then imported else
|
|
191 | 191 |
let lusic = import_dependency_aux decl.top_decl_loc (local, dep) |
192 | 192 |
in load_header_rec (ISet.add basename imported) lusic.Lusic.contents |
193 | 193 |
) imported program |
Also available in: Unified diff