diff options
author | Kenneth Bell <[email protected]> | 2023-09-11 23:27:47 +0100 |
---|---|---|
committer | Ayke <[email protected]> | 2023-09-21 01:18:05 +0200 |
commit | 58fafaeb5ce3ae0cdf0399dab392d24c2322b435 (patch) | |
tree | a58c6380251359d7283740a494d029b99308da8b | |
parent | 13a8eae0d4bce114405f175d4e73ec5a8b07a3aa (diff) | |
download | tinygo-58fafaeb5ce3ae0cdf0399dab392d24c2322b435.tar.gz tinygo-58fafaeb5ce3ae0cdf0399dab392d24c2322b435.zip |
build: #3893 do not return LLVM structs from Build
-rw-r--r-- | interp/errors.go | 8 | ||||
-rw-r--r-- | interp/interp_test.go | 8 | ||||
-rw-r--r-- | interp/interpreter.go | 2 | ||||
-rw-r--r-- | main.go | 8 |
4 files changed, 11 insertions, 15 deletions
diff --git a/interp/errors.go b/interp/errors.go index eaab781d5..7aad39fb8 100644 --- a/interp/errors.go +++ b/interp/errors.go @@ -35,14 +35,14 @@ func isRecoverableError(err error) bool { // ErrorLine is one line in a traceback. The position may be missing. type ErrorLine struct { Pos token.Position - Inst llvm.Value + Inst string } // Error encapsulates compile-time interpretation errors with an associated // import path. The errors may not have a precise location attached. type Error struct { ImportPath string - Inst llvm.Value + Inst string Pos token.Position Err error Traceback []ErrorLine @@ -60,10 +60,10 @@ func (r *runner) errorAt(inst instruction, err error) *Error { pos := getPosition(inst.llvmInst) return &Error{ ImportPath: r.pkgName, - Inst: inst.llvmInst, + Inst: inst.String(), Pos: pos, Err: err, - Traceback: []ErrorLine{{pos, inst.llvmInst}}, + Traceback: []ErrorLine{{pos, inst.String()}}, } } diff --git a/interp/interp_test.go b/interp/interp_test.go index 55ad3eaef..fc567af20 100644 --- a/interp/interp_test.go +++ b/interp/interp_test.go @@ -57,16 +57,14 @@ func runTest(t *testing.T, pathPrefix string) { if err != nil { if err, match := err.(*Error); match { println(err.Error()) - if !err.Inst.IsNil() { - err.Inst.Dump() - println() + if len(err.Inst) != 0 { + println(err.Inst) } if len(err.Traceback) > 0 { println("\ntraceback:") for _, line := range err.Traceback { println(line.Pos.String() + ":") - line.Inst.Dump() - println() + println(line.Inst) } } } diff --git a/interp/interpreter.go b/interp/interpreter.go index 8e5faf642..dcea0044a 100644 --- a/interp/interpreter.go +++ b/interp/interpreter.go @@ -543,7 +543,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent // how this function got called. callErr.Traceback = append(callErr.Traceback, ErrorLine{ Pos: getPosition(inst.llvmInst), - Inst: inst.llvmInst, + Inst: inst.String(), }) return nil, mem, callErr } @@ -1289,16 +1289,14 @@ func printCompilerError(logln func(...interface{}), err error) { case *interp.Error: logln("#", err.ImportPath) logln(err.Error()) - if !err.Inst.IsNil() { - err.Inst.Dump() - logln() + if len(err.Inst) != 0 { + logln(err.Inst) } if len(err.Traceback) > 0 { logln("\ntraceback:") for _, line := range err.Traceback { logln(line.Pos.String() + ":") - line.Inst.Dump() - logln() + logln(line.Inst) } } case loader.Errors: |