authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2019-11-06 21:18:32+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2019-11-07 10:30:21+02:00
log110e575497595330ac94b4cc57c0f6dc47c9f519
tree044814e8932a4c0ac1ea8093a955702af4a4e246
parentcb20093614efecb341f8b3260bf9f91bb10556e6
signaturelock-open Commit is signed but in an unrecognized format.

self hosted compiler: replace Promise with Frame and AnyFrame


1 files changed, 23 insertions(+), 7 deletions(-)

src-self-hosted/type.zig+23-7
...@@ -43,7 +43,8 @@ pub const Type = struct {...@@ -43,7 +43,8 @@ pub const Type = struct {
43 Id.BoundFn => @fieldParentPtr(BoundFn, "base", base).destroy(comp),43 Id.BoundFn => @fieldParentPtr(BoundFn, "base", base).destroy(comp),
44 Id.ArgTuple => @fieldParentPtr(ArgTuple, "base", base).destroy(comp),44 Id.ArgTuple => @fieldParentPtr(ArgTuple, "base", base).destroy(comp),
45 Id.Opaque => @fieldParentPtr(Opaque, "base", base).destroy(comp),45 Id.Opaque => @fieldParentPtr(Opaque, "base", base).destroy(comp),
46 Id.Promise => @fieldParentPtr(Promise, "base", base).destroy(comp),46 Id.Frame => @fieldParentPtr(Frame, "base", base).destroy(comp),
47 Id.AnyFrame => @fieldParentPtr(AnyFrame, "base", base).destroy(comp),
47 Id.Vector => @fieldParentPtr(Vector, "base", base).destroy(comp),48 Id.Vector => @fieldParentPtr(Vector, "base", base).destroy(comp),
48 }49 }
49 }50 }
...@@ -77,7 +78,8 @@ pub const Type = struct {...@@ -77,7 +78,8 @@ pub const Type = struct {
77 Id.BoundFn => return @fieldParentPtr(BoundFn, "base", base).getLlvmType(allocator, llvm_context),78 Id.BoundFn => return @fieldParentPtr(BoundFn, "base", base).getLlvmType(allocator, llvm_context),
78 Id.ArgTuple => unreachable,79 Id.ArgTuple => unreachable,
79 Id.Opaque => return @fieldParentPtr(Opaque, "base", base).getLlvmType(allocator, llvm_context),80 Id.Opaque => return @fieldParentPtr(Opaque, "base", base).getLlvmType(allocator, llvm_context),
80 Id.Promise => return @fieldParentPtr(Promise, "base", base).getLlvmType(allocator, llvm_context),81 Id.Frame => return @fieldParentPtr(Frame, "base", base).getLlvmType(allocator, llvm_context),
82 Id.AnyFrame => return @fieldParentPtr(AnyFrame, "base", base).getLlvmType(allocator, llvm_context),
81 Id.Vector => return @fieldParentPtr(Vector, "base", base).getLlvmType(allocator, llvm_context),83 Id.Vector => return @fieldParentPtr(Vector, "base", base).getLlvmType(allocator, llvm_context),
82 }84 }
83 }85 }
...@@ -104,7 +106,8 @@ pub const Type = struct {...@@ -104,7 +106,8 @@ pub const Type = struct {
104 Id.ErrorSet,106 Id.ErrorSet,
105 Id.Enum,107 Id.Enum,
106 Id.Fn,108 Id.Fn,
107 Id.Promise,109 Id.Frame,
110 Id.AnyFrame,
108 Id.Vector,111 Id.Vector,
109 => return false,112 => return false,
110113
...@@ -137,7 +140,8 @@ pub const Type = struct {...@@ -137,7 +140,8 @@ pub const Type = struct {
137 Id.Int,140 Id.Int,
138 Id.Float,141 Id.Float,
139 Id.Fn,142 Id.Fn,
140 Id.Promise,143 Id.Frame,
144 Id.AnyFrame,
141 Id.Vector,145 Id.Vector,
142 => return true,146 => return true,
143147
...@@ -1059,14 +1063,26 @@ pub const Type = struct {...@@ -1059,14 +1063,26 @@ pub const Type = struct {
1059 }1063 }
1060 };1064 };
10611065
1062 pub const Promise = struct {1066 pub const Frame = struct {
1063 base: Type,1067 base: Type,
10641068
1065 pub fn destroy(self: *Promise, comp: *Compilation) void {1069 pub fn destroy(self: *Frame, comp: *Compilation) void {
1066 comp.gpa().destroy(self);1070 comp.gpa().destroy(self);
1067 }1071 }
10681072
1069 pub fn getLlvmType(self: *Promise, allocator: *Allocator, llvm_context: *llvm.Context) *llvm.Type {1073 pub fn getLlvmType(self: *Frame, allocator: *Allocator, llvm_context: *llvm.Context) *llvm.Type {
1074 @panic("TODO");
1075 }
1076 };
1077
1078 pub const AnyFrame = struct {
1079 base: Type,
1080
1081 pub fn destroy(self: *AnyFrame, comp: *Compilation) void {
1082 comp.gpa().destroy(self);
1083 }
1084
1085 pub fn getLlvmType(self: *AnyFrame, allocator: *Allocator, llvm_context: *llvm.Context) *llvm.Type {
1070 @panic("TODO");1086 @panic("TODO");
1071 }1087 }
1072 };1088 };