Merge pull request #399 from visualfc/panicany
runtime: panic any custometype
This commit is contained in:
@@ -10,7 +10,9 @@ func gwrite(b []byte) {
|
||||
if len(b) == 0 {
|
||||
return
|
||||
}
|
||||
c.Printf(c.Str("%s"), b)
|
||||
for _, v := range b {
|
||||
c.Printf(c.Str("%c"), v)
|
||||
}
|
||||
}
|
||||
|
||||
func printbool(v bool) {
|
||||
@@ -200,6 +202,7 @@ func main() {
|
||||
int8(1), int16(2), int32(3), int64(4), 5,
|
||||
uint8(1), uint16(2), uint32(3), uint64(4), uintptr(5),
|
||||
"llgo")
|
||||
println(1 + 2i)
|
||||
}
|
||||
|
||||
func println(args ...any) {
|
||||
@@ -242,6 +245,16 @@ func printany(v any) {
|
||||
printfloat(float64(v))
|
||||
case float64:
|
||||
printfloat(float64(v))
|
||||
case complex64:
|
||||
printstring("(")
|
||||
printfloat(float64(real(v)))
|
||||
printfloat(float64(imag(v)))
|
||||
printstring("i)")
|
||||
case complex128:
|
||||
printstring("(")
|
||||
printfloat(real(v))
|
||||
printfloat(imag(v))
|
||||
printstring("i)")
|
||||
case string:
|
||||
printstring(v)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,9 +24,9 @@ source_filename = "main"
|
||||
@5 = private unnamed_addr constant [1 x i8] c"Y", align 1
|
||||
@6 = private unnamed_addr constant [1 x i8] c"Z", align 1
|
||||
@7 = private unnamed_addr constant [1 x i8] c"V", align 1
|
||||
@8 = private unnamed_addr constant [6 x i8] c"main.T", align 1
|
||||
@8 = private unnamed_addr constant [1 x i8] c"T", align 1
|
||||
@_llgo_main.N = linkonce global ptr null, align 8
|
||||
@9 = private unnamed_addr constant [6 x i8] c"main.N", align 1
|
||||
@9 = private unnamed_addr constant [1 x i8] c"N", align 1
|
||||
@__llgo_argc = global i32 0, align 4
|
||||
@__llgo_argv = global ptr null, align 8
|
||||
|
||||
@@ -749,7 +749,7 @@ _llgo_13: ; preds = %_llgo_12
|
||||
%105 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %104, i32 0, i32 0
|
||||
store ptr @8, ptr %105, align 8
|
||||
%106 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %104, i32 0, i32 1
|
||||
store i64 6, ptr %106, align 4
|
||||
store i64 1, ptr %106, align 4
|
||||
%107 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %104, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %24, %"github.com/goplus/llgo/internal/runtime.String" %103, %"github.com/goplus/llgo/internal/runtime.String" %107, ptr %99, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
br label %_llgo_14
|
||||
@@ -779,7 +779,7 @@ _llgo_17: ; preds = %_llgo_16
|
||||
%117 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %116, i32 0, i32 0
|
||||
store ptr @9, ptr %117, align 8
|
||||
%118 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %116, i32 0, i32 1
|
||||
store i64 6, ptr %118, align 4
|
||||
store i64 1, ptr %118, align 4
|
||||
%119 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %116, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %110, %"github.com/goplus/llgo/internal/runtime.String" %115, %"github.com/goplus/llgo/internal/runtime.String" %119, ptr %111, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
br label %_llgo_18
|
||||
|
||||
@@ -18,7 +18,7 @@ source_filename = "main"
|
||||
@1 = private unnamed_addr constant [4 x i8] c"main", align 1
|
||||
@2 = private unnamed_addr constant [5 x i8] c"Error", align 1
|
||||
@"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to" = linkonce global ptr null, align 8
|
||||
@3 = private unnamed_addr constant [16 x i8] c"main.errorString", align 1
|
||||
@3 = private unnamed_addr constant [11 x i8] c"errorString", align 1
|
||||
@"_llgo_iface$Fh8eUJ-Gw4e6TYuajcFIOSCuqSPKAt5nS4ow7xeGXEU" = linkonce global ptr null, align 8
|
||||
@__llgo_argc = global i32 0, align 4
|
||||
@__llgo_argv = global ptr null, align 8
|
||||
@@ -214,7 +214,7 @@ _llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%67 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %66, i32 0, i32 0
|
||||
store ptr @3, ptr %67, align 8
|
||||
%68 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %66, i32 0, i32 1
|
||||
store i64 16, ptr %68, align 4
|
||||
store i64 11, ptr %68, align 4
|
||||
%69 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %66, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %0, %"github.com/goplus/llgo/internal/runtime.String" %65, %"github.com/goplus/llgo/internal/runtime.String" %69, ptr %26, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %61)
|
||||
%70 = load ptr, ptr @_llgo_main.errorString, align 8
|
||||
|
||||
@@ -33,13 +33,13 @@ source_filename = "main"
|
||||
@_llgo_main.C1 = linkonce global ptr null, align 8
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null, align 8
|
||||
@9 = private unnamed_addr constant [1 x i8] c"f", align 1
|
||||
@10 = private unnamed_addr constant [7 x i8] c"main.C1", align 1
|
||||
@10 = private unnamed_addr constant [2 x i8] c"C1", align 1
|
||||
@11 = private unnamed_addr constant [17 x i8] c"C1 i1.(I0) failed", align 1
|
||||
@12 = private unnamed_addr constant [17 x i8] c"C1 i1.(I1) failed", align 1
|
||||
@13 = private unnamed_addr constant [20 x i8] c"C1 i1.(I2) succeeded", align 1
|
||||
@_llgo_main.C2 = linkonce global ptr null, align 8
|
||||
@14 = private unnamed_addr constant [1 x i8] c"g", align 1
|
||||
@15 = private unnamed_addr constant [7 x i8] c"main.C2", align 1
|
||||
@15 = private unnamed_addr constant [2 x i8] c"C2", align 1
|
||||
@16 = private unnamed_addr constant [17 x i8] c"C2 i1.(I0) failed", align 1
|
||||
@17 = private unnamed_addr constant [17 x i8] c"C2 i1.(I1) failed", align 1
|
||||
@18 = private unnamed_addr constant [17 x i8] c"C2 i1.(I2) failed", align 1
|
||||
@@ -1126,7 +1126,7 @@ _llgo_15: ; preds = %_llgo_14
|
||||
%216 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %215, i32 0, i32 0
|
||||
store ptr @10, ptr %216, align 8
|
||||
%217 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %215, i32 0, i32 1
|
||||
store i64 7, ptr %217, align 4
|
||||
store i64 2, ptr %217, align 4
|
||||
%218 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %215, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %161, %"github.com/goplus/llgo/internal/runtime.String" %214, %"github.com/goplus/llgo/internal/runtime.String" %218, ptr %175, %"github.com/goplus/llgo/internal/runtime.Slice" %203, %"github.com/goplus/llgo/internal/runtime.Slice" %210)
|
||||
br label %_llgo_16
|
||||
@@ -1248,7 +1248,7 @@ _llgo_19: ; preds = %_llgo_18
|
||||
%286 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %285, i32 0, i32 0
|
||||
store ptr @15, ptr %286, align 8
|
||||
%287 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %285, i32 0, i32 1
|
||||
store i64 7, ptr %287, align 4
|
||||
store i64 2, ptr %287, align 4
|
||||
%288 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %285, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %221, %"github.com/goplus/llgo/internal/runtime.String" %284, %"github.com/goplus/llgo/internal/runtime.String" %288, ptr %222, %"github.com/goplus/llgo/internal/runtime.Slice" %272, %"github.com/goplus/llgo/internal/runtime.Slice" %280)
|
||||
br label %_llgo_20
|
||||
|
||||
@@ -26,7 +26,7 @@ source_filename = "main"
|
||||
@4 = private unnamed_addr constant [8 x i8] c"main.two", align 1
|
||||
@"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to" = linkonce global ptr null, align 8
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@5 = private unnamed_addr constant [9 x i8] c"main.impl", align 1
|
||||
@5 = private unnamed_addr constant [4 x i8] c"impl", align 1
|
||||
@"main.iface$zZ89tENb5h_KNjvpxf1TXPfaWFYn0IZrZwyVf42lRtA" = global ptr null, align 8
|
||||
@_llgo_main.I = linkonce global ptr null, align 8
|
||||
@6 = private unnamed_addr constant [6 x i8] c"main.I", align 1
|
||||
@@ -847,7 +847,7 @@ _llgo_10: ; preds = %_llgo_9, %_llgo_8
|
||||
%121 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %120, i32 0, i32 0
|
||||
store ptr @5, ptr %121, align 8
|
||||
%122 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %120, i32 0, i32 1
|
||||
store i64 9, ptr %122, align 4
|
||||
store i64 4, ptr %122, align 4
|
||||
%123 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %120, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %0, %"github.com/goplus/llgo/internal/runtime.String" %119, %"github.com/goplus/llgo/internal/runtime.String" %123, ptr %14, %"github.com/goplus/llgo/internal/runtime.Slice" %107, %"github.com/goplus/llgo/internal/runtime.Slice" %115)
|
||||
%124 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
|
||||
@@ -25,18 +25,17 @@ source_filename = "main"
|
||||
@2 = private unnamed_addr constant [8 x i8] c"initGame", align 1
|
||||
@3 = private unnamed_addr constant [47 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame", align 1
|
||||
@4 = private unnamed_addr constant [38 x i8] c"github.com/goplus/llgo/cl/internal/foo", align 1
|
||||
@5 = private unnamed_addr constant [43 x i8] c"github.com/goplus/llgo/cl/internal/foo.Game", align 1
|
||||
@6 = private unnamed_addr constant [4 x i8] c"Game", align 1
|
||||
@7 = private unnamed_addr constant [10 x i8] c"main.Game1", align 1
|
||||
@5 = private unnamed_addr constant [4 x i8] c"Game", align 1
|
||||
@6 = private unnamed_addr constant [5 x i8] c"Game1", align 1
|
||||
@"*_llgo_main.Game2" = linkonce global ptr null, align 8
|
||||
@_llgo_main.Game2 = linkonce global ptr null, align 8
|
||||
@8 = private unnamed_addr constant [13 x i8] c"main.initGame", align 1
|
||||
@9 = private unnamed_addr constant [10 x i8] c"main.Game2", align 1
|
||||
@7 = private unnamed_addr constant [13 x i8] c"main.initGame", align 1
|
||||
@8 = private unnamed_addr constant [5 x i8] c"Game2", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/internal/foo.Gamer" = linkonce global ptr null, align 8
|
||||
@10 = private unnamed_addr constant [44 x i8] c"github.com/goplus/llgo/cl/internal/foo.Gamer", align 1
|
||||
@9 = private unnamed_addr constant [44 x i8] c"github.com/goplus/llgo/cl/internal/foo.Gamer", align 1
|
||||
@"main.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg" = global ptr null, align 8
|
||||
@11 = private unnamed_addr constant [2 x i8] c"OK", align 1
|
||||
@12 = private unnamed_addr constant [4 x i8] c"FAIL", align 1
|
||||
@10 = private unnamed_addr constant [2 x i8] c"OK", align 1
|
||||
@11 = private unnamed_addr constant [4 x i8] c"FAIL", align 1
|
||||
|
||||
define void @main.Game1.Load(%main.Game1 %0) {
|
||||
_llgo_0:
|
||||
@@ -181,7 +180,7 @@ _llgo_5: ; preds = %_llgo_4, %_llgo_3
|
||||
%49 = extractvalue { %"github.com/goplus/llgo/internal/runtime.iface", i1 } %47, 1
|
||||
%50 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %50, i32 0, i32 0
|
||||
store ptr @11, ptr %51, align 8
|
||||
store ptr @10, ptr %51, align 8
|
||||
%52 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %50, i32 0, i32 1
|
||||
store i64 2, ptr %52, align 4
|
||||
%53 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %50, align 8
|
||||
@@ -226,7 +225,7 @@ _llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%71 = extractvalue { %"github.com/goplus/llgo/internal/runtime.iface", i1 } %69, 1
|
||||
%72 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 0
|
||||
store ptr @12, ptr %73, align 8
|
||||
store ptr @11, ptr %73, align 8
|
||||
%74 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 1
|
||||
store i64 4, ptr %74, align 4
|
||||
%75 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %72, align 8
|
||||
@@ -399,7 +398,7 @@ _llgo_10: ; preds = %_llgo_9, %_llgo_7
|
||||
%77 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %76, i32 0, i32 0
|
||||
store ptr @5, ptr %77, align 8
|
||||
%78 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %76, i32 0, i32 1
|
||||
store i64 43, ptr %78, align 4
|
||||
store i64 4, ptr %78, align 4
|
||||
%79 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %76, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %5, %"github.com/goplus/llgo/internal/runtime.String" %75, %"github.com/goplus/llgo/internal/runtime.String" %79, ptr %19, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %71)
|
||||
br label %_llgo_8
|
||||
@@ -418,7 +417,7 @@ _llgo_12: ; preds = %_llgo_11, %_llgo_8
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
%84 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%85 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %84, i32 0, i32 0
|
||||
store ptr @6, ptr %85, align 8
|
||||
store ptr @5, ptr %85, align 8
|
||||
%86 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %84, i32 0, i32 1
|
||||
store i64 4, ptr %86, align 4
|
||||
%87 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %84, align 8
|
||||
@@ -516,9 +515,9 @@ _llgo_15: ; preds = %_llgo_14
|
||||
%143 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %140, align 8
|
||||
%144 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%145 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %144, i32 0, i32 0
|
||||
store ptr @7, ptr %145, align 8
|
||||
store ptr @6, ptr %145, align 8
|
||||
%146 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %144, i32 0, i32 1
|
||||
store i64 10, ptr %146, align 4
|
||||
store i64 5, ptr %146, align 4
|
||||
%147 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %144, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %2, %"github.com/goplus/llgo/internal/runtime.String" %143, %"github.com/goplus/llgo/internal/runtime.String" %147, ptr %105, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %139)
|
||||
br label %_llgo_16
|
||||
@@ -557,7 +556,7 @@ _llgo_21: ; preds = %_llgo_20
|
||||
%159 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %156, align 8
|
||||
%160 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%161 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %160, i32 0, i32 0
|
||||
store ptr @8, ptr %161, align 8
|
||||
store ptr @7, ptr %161, align 8
|
||||
%162 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %160, i32 0, i32 1
|
||||
store i64 13, ptr %162, align 4
|
||||
%163 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %160, align 8
|
||||
@@ -591,9 +590,9 @@ _llgo_21: ; preds = %_llgo_20
|
||||
%181 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %178, align 8
|
||||
%182 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%183 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %182, i32 0, i32 0
|
||||
store ptr @9, ptr %183, align 8
|
||||
store ptr @8, ptr %183, align 8
|
||||
%184 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %182, i32 0, i32 1
|
||||
store i64 10, ptr %184, align 4
|
||||
store i64 5, ptr %184, align 4
|
||||
%185 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %182, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %154, %"github.com/goplus/llgo/internal/runtime.String" %181, %"github.com/goplus/llgo/internal/runtime.String" %185, ptr %155, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %177)
|
||||
br label %_llgo_22
|
||||
@@ -662,7 +661,7 @@ _llgo_25: ; preds = %_llgo_24
|
||||
%221 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %218, align 8
|
||||
%222 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%223 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %222, i32 0, i32 0
|
||||
store ptr @10, ptr %223, align 8
|
||||
store ptr @9, ptr %223, align 8
|
||||
%224 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %222, i32 0, i32 1
|
||||
store i64 44, ptr %224, align 4
|
||||
%225 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %222, align 8
|
||||
|
||||
@@ -29,20 +29,20 @@ source_filename = "main"
|
||||
@_llgo_int = linkonce global ptr null, align 8
|
||||
@8 = private unnamed_addr constant [6 x i8] c"Method", align 1
|
||||
@"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac" = linkonce global ptr null, align 8
|
||||
@9 = private unnamed_addr constant [6 x i8] c"main.T", align 1
|
||||
@9 = private unnamed_addr constant [1 x i8] c"T", align 1
|
||||
@"_llgo_iface$uRUteI7wmSy7y7ODhGzk0FdDaxGKMhVSSu6HZEv9aa0" = linkonce global ptr null, align 8
|
||||
@"*_llgo_main.T" = linkonce global ptr null, align 8
|
||||
@_llgo_main.T1 = linkonce global ptr null, align 8
|
||||
@10 = private unnamed_addr constant [7 x i8] c"main.T1", align 1
|
||||
@10 = private unnamed_addr constant [2 x i8] c"T1", align 1
|
||||
@"*_llgo_main.T1" = linkonce global ptr null, align 8
|
||||
@_llgo_main.T2 = linkonce global ptr null, align 8
|
||||
@_llgo_float64 = linkonce global ptr null, align 8
|
||||
@11 = private unnamed_addr constant [7 x i8] c"main.T2", align 1
|
||||
@11 = private unnamed_addr constant [2 x i8] c"T2", align 1
|
||||
@"*_llgo_main.T2" = linkonce global ptr null, align 8
|
||||
@"*_llgo_main.T3" = linkonce global ptr null, align 8
|
||||
@_llgo_main.T3 = linkonce global ptr null, align 8
|
||||
@_llgo_int8 = linkonce global ptr null, align 8
|
||||
@12 = private unnamed_addr constant [7 x i8] c"main.T3", align 1
|
||||
@12 = private unnamed_addr constant [2 x i8] c"T3", align 1
|
||||
@"_llgo_iface$jwmSdgh1zvY_TDIgLzCkvkbiyrdwl9N806DH0JGcyMI" = linkonce global ptr null, align 8
|
||||
@13 = private unnamed_addr constant [5 x i8] c"world", align 1
|
||||
@_llgo_main.I = linkonce global ptr null, align 8
|
||||
@@ -675,7 +675,7 @@ _llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%118 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %117, i32 0, i32 0
|
||||
store ptr @9, ptr %118, align 8
|
||||
%119 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %117, i32 0, i32 1
|
||||
store i64 6, ptr %119, align 4
|
||||
store i64 1, ptr %119, align 4
|
||||
%120 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %117, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %2, %"github.com/goplus/llgo/internal/runtime.String" %116, %"github.com/goplus/llgo/internal/runtime.String" %120, ptr %28, %"github.com/goplus/llgo/internal/runtime.Slice" %104, %"github.com/goplus/llgo/internal/runtime.Slice" %112)
|
||||
br label %_llgo_6
|
||||
@@ -809,7 +809,7 @@ _llgo_19: ; preds = %_llgo_18
|
||||
%192 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %191, i32 0, i32 0
|
||||
store ptr @10, ptr %192, align 8
|
||||
%193 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %191, i32 0, i32 1
|
||||
store i64 7, ptr %193, align 4
|
||||
store i64 2, ptr %193, align 4
|
||||
%194 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %191, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %151, %"github.com/goplus/llgo/internal/runtime.String" %190, %"github.com/goplus/llgo/internal/runtime.String" %194, ptr %155, %"github.com/goplus/llgo/internal/runtime.Slice" %179, %"github.com/goplus/llgo/internal/runtime.Slice" %186)
|
||||
br label %_llgo_20
|
||||
@@ -917,7 +917,7 @@ _llgo_27: ; preds = %_llgo_26
|
||||
%248 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %247, i32 0, i32 0
|
||||
store ptr @11, ptr %248, align 8
|
||||
%249 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %247, i32 0, i32 1
|
||||
store i64 7, ptr %249, align 4
|
||||
store i64 2, ptr %249, align 4
|
||||
%250 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %247, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %201, %"github.com/goplus/llgo/internal/runtime.String" %246, %"github.com/goplus/llgo/internal/runtime.String" %250, ptr %211, %"github.com/goplus/llgo/internal/runtime.Slice" %235, %"github.com/goplus/llgo/internal/runtime.Slice" %242)
|
||||
br label %_llgo_28
|
||||
@@ -1004,7 +1004,7 @@ _llgo_35: ; preds = %_llgo_34
|
||||
%291 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %290, i32 0, i32 0
|
||||
store ptr @12, ptr %291, align 8
|
||||
%292 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %290, i32 0, i32 1
|
||||
store i64 7, ptr %292, align 4
|
||||
store i64 2, ptr %292, align 4
|
||||
%293 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %290, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %257, %"github.com/goplus/llgo/internal/runtime.String" %289, %"github.com/goplus/llgo/internal/runtime.String" %293, ptr %267, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %285)
|
||||
br label %_llgo_36
|
||||
|
||||
@@ -44,10 +44,10 @@ source_filename = "main"
|
||||
@9 = private unnamed_addr constant [6 x i8] c"Reader", align 1
|
||||
@10 = private unnamed_addr constant [5 x i8] c"Close", align 1
|
||||
@"_llgo_func$8rsrSd_r3UHd_2DiYTyaOKR7BYkei4zw5ysG35KF38w" = linkonce global ptr null, align 8
|
||||
@11 = private unnamed_addr constant [22 x i8] c"main.nopCloserWriterTo", align 1
|
||||
@11 = private unnamed_addr constant [17 x i8] c"nopCloserWriterTo", align 1
|
||||
@"_llgo_iface$L2Ik-AJcd0jsoBw5fQ07pQpfUM-kh78Wn2bOeak6M3I" = linkonce global ptr null, align 8
|
||||
@_llgo_main.nopCloser = global ptr null, align 8
|
||||
@12 = private unnamed_addr constant [14 x i8] c"main.nopCloser", align 1
|
||||
@12 = private unnamed_addr constant [9 x i8] c"nopCloser", align 1
|
||||
@_llgo_main.StringWriter = linkonce global ptr null, align 8
|
||||
@"_llgo_func$thH5FBpdXzJNnCpSfiLU5ItTntFU6LWp0RJhDm2XJjw" = linkonce global ptr null, align 8
|
||||
@13 = private unnamed_addr constant [11 x i8] c"WriteString", align 1
|
||||
@@ -79,12 +79,12 @@ source_filename = "main"
|
||||
@"_llgo_func$Eoig9xhJM5GShHH5aNPxTZZXp1IZxprRl4zPuv2hkug" = linkonce global ptr null, align 8
|
||||
@27 = private unnamed_addr constant [10 x i8] c"UnreadByte", align 1
|
||||
@28 = private unnamed_addr constant [10 x i8] c"UnreadRune", align 1
|
||||
@29 = private unnamed_addr constant [17 x i8] c"main.stringReader", align 1
|
||||
@29 = private unnamed_addr constant [12 x i8] c"stringReader", align 1
|
||||
@"_llgo_iface$OFO8Us9n8ajWCabGedeuoJ-Za2zAMk4Jh0FunAcUCFE" = linkonce global ptr null, align 8
|
||||
@"*_llgo_main.errorString" = global ptr null, align 8
|
||||
@_llgo_main.errorString = global ptr null, align 8
|
||||
@"main.struct$QTufDJA9wEDzuzgkA-ZSrLqW-B6lWN8O25mTSglAoLQ" = global ptr null, align 8
|
||||
@30 = private unnamed_addr constant [16 x i8] c"main.errorString", align 1
|
||||
@30 = private unnamed_addr constant [11 x i8] c"errorString", align 1
|
||||
@"_llgo_iface$Fh8eUJ-Gw4e6TYuajcFIOSCuqSPKAt5nS4ow7xeGXEU" = linkonce global ptr null, align 8
|
||||
@31 = private unnamed_addr constant [21 x i8] c"type assertion failed", align 1
|
||||
@32 = private unnamed_addr constant [37 x i8] c"stringsReader.ReadAt: negative offset", align 1
|
||||
@@ -1706,7 +1706,7 @@ _llgo_30: ; preds = %_llgo_29, %_llgo_28
|
||||
%336 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %335, i32 0, i32 0
|
||||
store ptr @11, ptr %336, align 8
|
||||
%337 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %335, i32 0, i32 1
|
||||
store i64 22, ptr %337, align 4
|
||||
store i64 17, ptr %337, align 4
|
||||
%338 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %335, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %192, %"github.com/goplus/llgo/internal/runtime.String" %334, %"github.com/goplus/llgo/internal/runtime.String" %338, ptr %244, %"github.com/goplus/llgo/internal/runtime.Slice" %321, %"github.com/goplus/llgo/internal/runtime.Slice" %330)
|
||||
%339 = load ptr, ptr @"_llgo_func$8rsrSd_r3UHd_2DiYTyaOKR7BYkei4zw5ysG35KF38w", align 8
|
||||
@@ -1863,7 +1863,7 @@ _llgo_32: ; preds = %_llgo_31, %_llgo_30
|
||||
%433 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %432, i32 0, i32 0
|
||||
store ptr @12, ptr %433, align 8
|
||||
%434 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %432, i32 0, i32 1
|
||||
store i64 14, ptr %434, align 4
|
||||
store i64 9, ptr %434, align 4
|
||||
%435 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %432, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %376, %"github.com/goplus/llgo/internal/runtime.String" %431, %"github.com/goplus/llgo/internal/runtime.String" %435, ptr %377, %"github.com/goplus/llgo/internal/runtime.Slice" %419, %"github.com/goplus/llgo/internal/runtime.Slice" %427)
|
||||
%436 = load ptr, ptr @_llgo_string, align 8
|
||||
@@ -2499,7 +2499,7 @@ _llgo_52: ; preds = %_llgo_51, %_llgo_50
|
||||
%814 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %813, i32 0, i32 0
|
||||
store ptr @29, ptr %814, align 8
|
||||
%815 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %813, i32 0, i32 1
|
||||
store i64 17, ptr %815, align 4
|
||||
store i64 12, ptr %815, align 4
|
||||
%816 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %813, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %511, %"github.com/goplus/llgo/internal/runtime.String" %812, %"github.com/goplus/llgo/internal/runtime.String" %816, ptr %556, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %808)
|
||||
%817 = load ptr, ptr @_llgo_main.stringReader, align 8
|
||||
@@ -2625,7 +2625,7 @@ _llgo_54: ; preds = %_llgo_53, %_llgo_52
|
||||
%893 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %892, i32 0, i32 0
|
||||
store ptr @30, ptr %893, align 8
|
||||
%894 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %892, i32 0, i32 1
|
||||
store i64 16, ptr %894, align 4
|
||||
store i64 11, ptr %894, align 4
|
||||
%895 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %892, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %846, %"github.com/goplus/llgo/internal/runtime.String" %891, %"github.com/goplus/llgo/internal/runtime.String" %895, ptr %869, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %887)
|
||||
%896 = load ptr, ptr @_llgo_main.errorString, align 8
|
||||
|
||||
@@ -22,11 +22,11 @@ source_filename = "main"
|
||||
@3 = private unnamed_addr constant [2 x i8] c"Pb", align 1
|
||||
@"_llgo_func$NfGSLZ1QiKRoFkKeqYSXE5hUU5bpeteSJKrbMNUzYRE" = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [38 x i8] c"github.com/goplus/llgo/cl/internal/foo", align 1
|
||||
@5 = private unnamed_addr constant [42 x i8] c"github.com/goplus/llgo/cl/internal/foo.Foo", align 1
|
||||
@5 = private unnamed_addr constant [3 x i8] c"Foo", align 1
|
||||
@_llgo_main.bar = global ptr null, align 8
|
||||
@"main.struct$Ci43nzKYkRLddRL_N4mkykxLXfJlqJGS5n04LKThPNo" = global ptr null, align 8
|
||||
@6 = private unnamed_addr constant [1 x i8] c"f", align 1
|
||||
@7 = private unnamed_addr constant [8 x i8] c"main.bar", align 1
|
||||
@7 = private unnamed_addr constant [3 x i8] c"bar", align 1
|
||||
@__llgo_argc = global i32 0, align 4
|
||||
@__llgo_argv = global ptr null, align 8
|
||||
@8 = private unnamed_addr constant [6 x i8] c"notOk:", align 1
|
||||
@@ -357,7 +357,7 @@ _llgo_10: ; preds = %_llgo_12, %_llgo_8
|
||||
%100 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %99, i32 0, i32 0
|
||||
store ptr @7, ptr %100, align 8
|
||||
%101 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %99, i32 0, i32 1
|
||||
store i64 8, ptr %101, align 4
|
||||
store i64 3, ptr %101, align 4
|
||||
%102 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %99, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %60, %"github.com/goplus/llgo/internal/runtime.String" %98, %"github.com/goplus/llgo/internal/runtime.String" %102, ptr %94, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
ret void
|
||||
@@ -441,7 +441,7 @@ _llgo_12: ; preds = %_llgo_11, %_llgo_9
|
||||
%149 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %148, i32 0, i32 0
|
||||
store ptr @5, ptr %149, align 8
|
||||
%150 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %148, i32 0, i32 1
|
||||
store i64 42, ptr %150, align 4
|
||||
store i64 3, ptr %150, align 4
|
||||
%151 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %148, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %2, %"github.com/goplus/llgo/internal/runtime.String" %147, %"github.com/goplus/llgo/internal/runtime.String" %151, ptr %52, %"github.com/goplus/llgo/internal/runtime.Slice" %136, %"github.com/goplus/llgo/internal/runtime.Slice" %143)
|
||||
br label %_llgo_10
|
||||
|
||||
@@ -43,7 +43,7 @@ source_filename = "main"
|
||||
@7 = private unnamed_addr constant [4 x i8] c"main", align 1
|
||||
@_llgo_main.T = linkonce global ptr null, align 8
|
||||
@8 = private unnamed_addr constant [6 x i8] c"Invoke", align 1
|
||||
@9 = private unnamed_addr constant [6 x i8] c"main.T", align 1
|
||||
@9 = private unnamed_addr constant [1 x i8] c"T", align 1
|
||||
|
||||
define void @"main.(*T).Invoke"(ptr %0) {
|
||||
_llgo_0:
|
||||
@@ -876,7 +876,7 @@ _llgo_41: ; preds = %_llgo_40
|
||||
%185 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %184, i32 0, i32 0
|
||||
store ptr @9, ptr %185, align 8
|
||||
%186 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %184, i32 0, i32 1
|
||||
store i64 6, ptr %186, align 4
|
||||
store i64 1, ptr %186, align 4
|
||||
%187 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %184, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %160, %"github.com/goplus/llgo/internal/runtime.String" %183, %"github.com/goplus/llgo/internal/runtime.String" %187, ptr %161, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %179)
|
||||
br label %_llgo_42
|
||||
|
||||
@@ -16,6 +16,13 @@
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/llgo/c/bitcast"
|
||||
"github.com/goplus/llgo/internal/abi"
|
||||
)
|
||||
|
||||
type errorString string
|
||||
|
||||
func (e errorString) RuntimeError() {}
|
||||
@@ -41,3 +48,99 @@ func AssertIndexRange(b bool) {
|
||||
panic(errorString("index out of range").Error())
|
||||
}
|
||||
}
|
||||
|
||||
// printany prints an argument passed to panic.
|
||||
// If panic is called with a value that has a String or Error method,
|
||||
// it has already been converted into a string by preprintpanics.
|
||||
func printany(i any) {
|
||||
switch v := i.(type) {
|
||||
case nil:
|
||||
print("nil")
|
||||
case bool:
|
||||
print(v)
|
||||
case int:
|
||||
print(v)
|
||||
case int8:
|
||||
print(v)
|
||||
case int16:
|
||||
print(v)
|
||||
case int32:
|
||||
print(v)
|
||||
case int64:
|
||||
print(v)
|
||||
case uint:
|
||||
print(v)
|
||||
case uint8:
|
||||
print(v)
|
||||
case uint16:
|
||||
print(v)
|
||||
case uint32:
|
||||
print(v)
|
||||
case uint64:
|
||||
print(v)
|
||||
case uintptr:
|
||||
print(v)
|
||||
case float32:
|
||||
print(v)
|
||||
case float64:
|
||||
print(v)
|
||||
case complex64:
|
||||
print(v)
|
||||
case complex128:
|
||||
print(v)
|
||||
case string:
|
||||
print(v)
|
||||
default:
|
||||
printanycustomtype(i)
|
||||
}
|
||||
}
|
||||
|
||||
func efaceOf(ep *any) *eface {
|
||||
return (*eface)(unsafe.Pointer(ep))
|
||||
}
|
||||
|
||||
func printanycustomtype(i any) {
|
||||
e := efaceOf(&i)
|
||||
typestring := e._type.String()
|
||||
|
||||
switch e._type.Kind() {
|
||||
case abi.String:
|
||||
print(typestring, `("`, *(*string)(e.data), `")`)
|
||||
case abi.Bool:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", uintptr(e.data) != 0, ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*bool)(e.data), ")")
|
||||
}
|
||||
case abi.Int, abi.Int8, abi.Int16, abi.Int32, abi.Int64:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", int64(uintptr(e.data)), ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*int64)(e.data), ")")
|
||||
}
|
||||
case abi.Uint, abi.Uint8, abi.Uint16, abi.Uint32, abi.Uint64, abi.Uintptr:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", uint64(uintptr(e.data)), ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*uint64)(e.data), ")")
|
||||
}
|
||||
case abi.Float32:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", bitcast.ToFloat32((uintptr(e.data))), ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*float32)(e.data), ")")
|
||||
}
|
||||
case abi.Float64:
|
||||
if isDirectIface(e._type) {
|
||||
print(typestring, "(", bitcast.ToFloat64(uintptr(e.data)), ")")
|
||||
} else {
|
||||
print(typestring, "(", *(*float64)(e.data), ")")
|
||||
}
|
||||
case abi.Complex64:
|
||||
println(typestring, *(*complex64)(e.data))
|
||||
case abi.Complex128:
|
||||
println(typestring, *(*complex128)(e.data))
|
||||
default:
|
||||
print("(", typestring, ") ", e.data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,11 +113,24 @@ func NewNamed(kind abi.Kind, methods, ptrMethods int) *Type {
|
||||
return ret
|
||||
}
|
||||
|
||||
func lastSlash(s string) int {
|
||||
i := len(s) - 1
|
||||
for i >= 0 && s[i] != '/' {
|
||||
i--
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
func pkgName(path string) string {
|
||||
i := lastSlash(path)
|
||||
return path[i+1:]
|
||||
}
|
||||
|
||||
// InitNamed initializes an uninitialized named type.
|
||||
func InitNamed(ret *Type, pkgPath, name string, underlying *Type, methods, ptrMethods []Method) {
|
||||
ptr := ret.PtrToThis_
|
||||
if pkgPath != "" {
|
||||
name = pkgPath + "." + name
|
||||
name = pkgName(pkgPath) + "." + name
|
||||
}
|
||||
doInitNamed(ret, pkgPath, name, underlying, methods)
|
||||
doInitNamed(ptr, pkgPath, name, newPointer(ret), ptrMethods)
|
||||
|
||||
@@ -20,9 +20,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/c/bitcast"
|
||||
"github.com/goplus/llgo/c/pthread"
|
||||
"github.com/goplus/llgo/internal/abi"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -48,6 +46,12 @@ func Recover() (ret any) {
|
||||
|
||||
// Panic panics with a value.
|
||||
func Panic(v any) {
|
||||
switch e := v.(type) {
|
||||
case error:
|
||||
v = e.Error()
|
||||
case interface{ String() string }:
|
||||
v = e.String()
|
||||
}
|
||||
ptr := c.Malloc(unsafe.Sizeof(v))
|
||||
*(*any)(ptr) = v
|
||||
excepKey.Set(ptr)
|
||||
@@ -85,54 +89,8 @@ func unpackEface(i any) *eface {
|
||||
// TracePanic prints panic message.
|
||||
func TracePanic(v any) {
|
||||
print("panic: ")
|
||||
switch e := v.(type) {
|
||||
case nil:
|
||||
println("nil")
|
||||
return
|
||||
case (interface{ Error() string }):
|
||||
println(e.Error())
|
||||
return
|
||||
case (interface{ String() string }):
|
||||
println(e.String())
|
||||
return
|
||||
}
|
||||
e := unpackEface(v)
|
||||
switch e.Kind() {
|
||||
case abi.Int, abi.Int8, abi.Int16, abi.Int32, abi.Int64:
|
||||
if isDirectIface(e._type) {
|
||||
println(int64(uintptr(e.data)))
|
||||
} else {
|
||||
println(*(*int64)(e.data))
|
||||
}
|
||||
case abi.Uint, abi.Uint8, abi.Uint16, abi.Uint32, abi.Uint64, abi.Uintptr:
|
||||
if isDirectIface(e._type) {
|
||||
println(uint64(uintptr(e.data)))
|
||||
} else {
|
||||
println(*(*uint64)(e.data))
|
||||
}
|
||||
case abi.Float32:
|
||||
if isDirectIface(e._type) {
|
||||
println(bitcast.ToFloat32((uintptr(e.data))))
|
||||
} else {
|
||||
println(*(*float32)(e.data))
|
||||
}
|
||||
case abi.Float64:
|
||||
if isDirectIface(e._type) {
|
||||
println(bitcast.ToFloat64(uintptr(e.data)))
|
||||
} else {
|
||||
println(*(*float64)(e.data))
|
||||
}
|
||||
case abi.Complex64:
|
||||
println(*(*complex64)(e.data))
|
||||
case abi.Complex128:
|
||||
println(*(*complex128)(e.data))
|
||||
case abi.String:
|
||||
println(*(*string)(e.data))
|
||||
default:
|
||||
// TODO kind to e._type.Str_
|
||||
print("(", e.Kind(), ") ")
|
||||
println(e.data)
|
||||
}
|
||||
printany(v)
|
||||
println("\n")
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -202,7 +202,7 @@ func (b Builder) abiInitNamed(ret Expr, t *types.Named) func() Expr {
|
||||
pkg := b.Pkg
|
||||
prog := b.Prog
|
||||
path := abi.PathOf(t.Obj().Pkg())
|
||||
name := NameOf(t)
|
||||
name := t.Obj().Name()
|
||||
var initNamed = pkg.rtFunc("InitNamed")
|
||||
var tSlice = lastParamType(prog, initNamed)
|
||||
mset := typeutil.IntuitiveMethodSet(t, nil)
|
||||
|
||||
@@ -118,6 +118,12 @@ func (p Program) Zero(t Type) Expr {
|
||||
ret = llvm.ConstFloat(p.Float64().ll, 0)
|
||||
case kind == types.Float32:
|
||||
ret = llvm.ConstFloat(p.Float32().ll, 0)
|
||||
case kind == types.Complex64:
|
||||
v := llvm.ConstFloat(p.Float32().ll, 0)
|
||||
ret = llvm.ConstStruct([]llvm.Value{v, v}, false)
|
||||
case kind == types.Complex128:
|
||||
v := llvm.ConstFloat(p.Float64().ll, 0)
|
||||
ret = llvm.ConstStruct([]llvm.Value{v, v}, false)
|
||||
default:
|
||||
panic("todo")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user