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 {
4343 Id.BoundFn => @fieldParentPtr(BoundFn, "base", base).destroy(comp),
4444 Id.ArgTuple => @fieldParentPtr(ArgTuple, "base", base).destroy(comp),
4545 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),
4748 Id.Vector => @fieldParentPtr(Vector, "base", base).destroy(comp),
4849 }
4950 }
......@@ -77,7 +78,8 @@ pub const Type = struct {
7778 Id.BoundFn => return @fieldParentPtr(BoundFn, "base", base).getLlvmType(allocator, llvm_context),
7879 Id.ArgTuple => unreachable,
7980 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),
8183 Id.Vector => return @fieldParentPtr(Vector, "base", base).getLlvmType(allocator, llvm_context),
8284 }
8385 }
......@@ -104,7 +106,8 @@ pub const Type = struct {
104106 Id.ErrorSet,
105107 Id.Enum,
106108 Id.Fn,
107 Id.Promise,
109 Id.Frame,
110 Id.AnyFrame,
108111 Id.Vector,
109112 => return false,
110113
......@@ -137,7 +140,8 @@ pub const Type = struct {
137140 Id.Int,
138141 Id.Float,
139142 Id.Fn,
140 Id.Promise,
143 Id.Frame,
144 Id.AnyFrame,
141145 Id.Vector,
142146 => return true,
143147
......@@ -1059,14 +1063,26 @@ pub const Type = struct {
10591063 }
10601064 };
10611065
1062 pub const Promise = struct {
1066 pub const Frame = struct {
10631067 base: Type,
10641068
1065 pub fn destroy(self: *Promise, comp: *Compilation) void {
1069 pub fn destroy(self: *Frame, comp: *Compilation) void {
10661070 comp.gpa().destroy(self);
10671071 }
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 {
10701086 @panic("TODO");
10711087 }
10721088 };