aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 19:14:21 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 19:14:21 -0400
commitbc93dea8186168aa015b05a615bc1873173393b5 (patch)
tree9e855f972a09db642f15d92401cd36353d4beafd
parentdd758d0a05979a3c4a4c2eee3a2a26622f0e7b45 (diff)
Remove dead code for handling Declare statments with Use inside
-rw-r--r--src/ast.c4
-rw-r--r--src/tomo.c8
2 files changed, 2 insertions, 10 deletions
diff --git a/src/ast.c b/src/ast.c
index c78f4f1a..d4fd9569 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -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);
}
}
diff --git a/src/tomo.c b/src/tomo.c
index b52b6d4b..effa74bd 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -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);