diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 19:14:21 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 19:14:21 -0400 |
| commit | bc93dea8186168aa015b05a615bc1873173393b5 (patch) | |
| tree | 9e855f972a09db642f15d92401cd36353d4beafd | |
| parent | dd758d0a05979a3c4a4c2eee3a2a26622f0e7b45 (diff) | |
Remove dead code for handling Declare statments with Use inside
| -rw-r--r-- | src/ast.c | 4 | ||||
| -rw-r--r-- | src/tomo.c | 8 |
2 files changed, 2 insertions, 10 deletions
@@ -324,7 +324,7 @@ void visit_topologically(ast_list_t *asts, Closure_t fn) Table_t visited = {}; // First: 'use' statements in order: for (ast_list_t *stmt = asts; stmt; stmt = stmt->next) { - if (stmt->ast->tag == Use || (stmt->ast->tag == Declare && Match(stmt->ast, Declare)->value->tag == Use)) + if (stmt->ast->tag == Use) visit(fn.userdata, stmt->ast); } // Then typedefs in topological order: @@ -335,7 +335,7 @@ void visit_topologically(ast_list_t *asts, Closure_t fn) // Then everything else in order: for (ast_list_t *stmt = asts; stmt; stmt = stmt->next) { if (!(stmt->ast->tag == StructDef || stmt->ast->tag == EnumDef || stmt->ast->tag == LangDef - || stmt->ast->tag == Use || (stmt->ast->tag == Declare && Match(stmt->ast, Declare)->value->tag == Use))) { + || stmt->ast->tag == Use)) { visit(fn.userdata, stmt->ast); } } @@ -329,9 +329,6 @@ typedef struct { static void _compile_statement_header_for_library(libheader_info_t *info, ast_t *ast) { - if (ast->tag == Declare && Match(ast, Declare)->value->tag == Use) - ast = Match(ast, Declare)->value; - if (ast->tag == Use) { auto use = Match(ast, Use); if (use->what == USE_LOCAL) @@ -391,8 +388,6 @@ static void _compile_file_header_for_library(env_t *env, Path_t header_path, Pat // Visit files in topological order: for (ast_list_t *stmt = Match(file_ast, Block)->statements; stmt; stmt = stmt->next) { ast_t *ast = stmt->ast; - if (ast->tag == Declare) - ast = Match(ast, Declare)->value; if (ast->tag != Use) continue; auto use = Match(ast, Use); @@ -600,9 +595,6 @@ void build_file_dependency_graph(Path_t path, Table_t *to_compile, Table_t *to_l for (ast_list_t *stmt = Match(ast, Block)->statements; stmt; stmt = stmt->next) { ast_t *stmt_ast = stmt->ast; - if (stmt_ast->tag == Declare) - stmt_ast = Match(stmt_ast, Declare)->value; - if (stmt_ast->tag != Use) continue; auto use = Match(stmt_ast, Use); |
