diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-12-03 17:26:26 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-12-03 17:26:26 -0500 |
| commit | 38791ac616069963fd808ec724161b93cbc564c1 (patch) | |
| tree | 1f4c254a76a3c5d016574c1e124a392973383964 /src/analyze.cpp | |
| parent | fd7c7be33c95fd1bd77010378b407fc9fb4933e2 (diff) | |
| parent | 521744bb91b486bfab7d9a6bd74dd658da95ea18 (diff) | |
| download | zig-38791ac616069963fd808ec724161b93cbc564c1.tar.gz zig-38791ac616069963fd808ec724161b93cbc564c1.zip | |
Merge branch 'Vexu-build-start'
closes #3810
closes #3793
closes #3798
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 7d75bef7d9..d616148596 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -3304,17 +3304,6 @@ ZigFn *create_fn(CodeGen *g, AstNode *proto_node) { return fn_entry; } -static bool scope_is_root_decls(Scope *scope) { - while (scope) { - if (scope->id == ScopeIdDecls) { - ScopeDecls *scope_decls = (ScopeDecls *)scope; - return is_top_level_struct(scope_decls->container_type); - } - scope = scope->parent; - } - zig_unreachable(); -} - ZigType *get_test_fn_type(CodeGen *g) { if (g->test_fn_type) return g->test_fn_type; @@ -3353,7 +3342,6 @@ void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, const char *symbol_name, G } static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) { - ZigType *import = tld_fn->base.import; AstNode *source_node = tld_fn->base.source_node; if (source_node->type == NodeTypeFnProto) { AstNodeFnProto *fn_proto = &source_node->data.fn_proto; @@ -3433,12 +3421,6 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) { if (fn_table_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync) { fn_table_entry->inferred_async_node = fn_table_entry->proto_node; } - - if (scope_is_root_decls(tld_fn->base.parent_scope) && import == g->root_import) { - if (g->have_pub_main && buf_eql_str(tld_fn->base.name, "main")) { - g->main_fn = fn_table_entry; - } - } } else if (source_node->type == NodeTypeTestDecl) { ZigFn *fn_table_entry = create_fn_raw(g, FnInlineAuto); @@ -4813,26 +4795,6 @@ ZigType *add_source_file(CodeGen *g, ZigPackage *package, Buf *resolved_path, Bu ast_print(stderr, root_node, 0); } - if (source_kind == SourceKindRoot) { - // Look for main - for (size_t decl_i = 0; decl_i < root_node->data.container_decl.decls.length; decl_i += 1) { - AstNode *top_level_decl = root_node->data.container_decl.decls.at(decl_i); - - if (top_level_decl->type == NodeTypeFnDef) { - AstNode *proto_node = top_level_decl->data.fn_def.fn_proto; - assert(proto_node->type == NodeTypeFnProto); - Buf *proto_name = proto_node->data.fn_proto.name; - - bool is_pub = (proto_node->data.fn_proto.visib_mod == VisibModPub); - if (is_pub) { - if (buf_eql_str(proto_name, "main")) { - g->have_pub_main = true; - } - } - } - } - } - for (size_t decl_i = 0; decl_i < root_node->data.container_decl.decls.length; decl_i += 1) { AstNode *top_level_decl = root_node->data.container_decl.decls.at(decl_i); scan_decls(g, import_entry->data.structure.decls_scope, top_level_decl); |
