From 86c7f7dd6a29efeefe45bbe5145cb15d4564b72f Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 27 Sep 2019 13:39:04 -0300 Subject: [PATCH] comp_ctx: remove Environment in favor of UnderlyingTypeMap --- examples/hello.ry | 6 +++++- src/comp_ctx.zig | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/hello.ry b/examples/hello.ry index 4c0dad8..87afcde 100644 --- a/examples/hello.ry +++ b/examples/hello.ry @@ -7,7 +7,7 @@ fn f() i32 { return 2; } -fn f2() i64 { +fn f2() i32 { return 1301; } @@ -48,3 +48,7 @@ fn and_fn() bool { // print("piss\n"); // // print("2 + 2 = %d\n", add(1, 2)); //} + +fn _start() i32 { + return 0; +} diff --git a/src/comp_ctx.zig b/src/comp_ctx.zig index ac1cfa8..0a407e3 100644 --- a/src/comp_ctx.zig +++ b/src/comp_ctx.zig @@ -31,11 +31,10 @@ pub const SymbolUnderlyingType = union(SymbolUnderlyingTypeEnum) { Enum: []const u8, }; -pub const Environment = std.StringHashMap(SymbolUnderlyingType); pub const ScopeList = std.ArrayList(*Scope); pub const Scope = struct { parent: ?*Scope, - env: Environment, + env: UnderlyingTypeMap, /// Used for debug information. children: ScopeList, @@ -48,7 +47,7 @@ pub const Scope = struct { scope.* = Scope{ .parent = parent, - .env = Environment.init(allocator), + .env = UnderlyingTypeMap.init(allocator), .children = ScopeList.init(allocator), .allocator = allocator, .id = id,