| 1 | import v2.ast |
| 2 | |
| 3 | fn main() { |
| 4 | file := ast.File{ |
| 5 | name: @FILE |
| 6 | mod: 'main' |
| 7 | imports: [ |
| 8 | ast.ImportStmt{ |
| 9 | name: 'v2.pref' |
| 10 | alias: 'pref' |
| 11 | }, |
| 12 | ] |
| 13 | stmts: [ |
| 14 | ast.Stmt(ast.ImportStmt{ |
| 15 | name: 'v2.pref' |
| 16 | alias: 'pref' |
| 17 | }), |
| 18 | ] |
| 19 | } |
| 20 | flat := ast.flatten_files([file]) |
| 21 | file_node := flat.nodes[flat.files[0].file_id] |
| 22 | imports := flat.file_cursor(0).imports().import_stmts() |
| 23 | println(file_node.edge_count) |
| 24 | println(imports.len) |
| 25 | if imports.len > 0 { |
| 26 | println(imports[0].name) |
| 27 | println(imports[0].alias) |
| 28 | } |
| 29 | } |
| 30 |