mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-23 13:59:02 +00:00
build: #3893 do not return LLVM structs from Build
This commit is contained in:
+4
-4
@@ -35,14 +35,14 @@ func isRecoverableError(err error) bool {
|
|||||||
// ErrorLine is one line in a traceback. The position may be missing.
|
// ErrorLine is one line in a traceback. The position may be missing.
|
||||||
type ErrorLine struct {
|
type ErrorLine struct {
|
||||||
Pos token.Position
|
Pos token.Position
|
||||||
Inst llvm.Value
|
Inst string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error encapsulates compile-time interpretation errors with an associated
|
// Error encapsulates compile-time interpretation errors with an associated
|
||||||
// import path. The errors may not have a precise location attached.
|
// import path. The errors may not have a precise location attached.
|
||||||
type Error struct {
|
type Error struct {
|
||||||
ImportPath string
|
ImportPath string
|
||||||
Inst llvm.Value
|
Inst string
|
||||||
Pos token.Position
|
Pos token.Position
|
||||||
Err error
|
Err error
|
||||||
Traceback []ErrorLine
|
Traceback []ErrorLine
|
||||||
@@ -60,10 +60,10 @@ func (r *runner) errorAt(inst instruction, err error) *Error {
|
|||||||
pos := getPosition(inst.llvmInst)
|
pos := getPosition(inst.llvmInst)
|
||||||
return &Error{
|
return &Error{
|
||||||
ImportPath: r.pkgName,
|
ImportPath: r.pkgName,
|
||||||
Inst: inst.llvmInst,
|
Inst: inst.String(),
|
||||||
Pos: pos,
|
Pos: pos,
|
||||||
Err: err,
|
Err: err,
|
||||||
Traceback: []ErrorLine{{pos, inst.llvmInst}},
|
Traceback: []ErrorLine{{pos, inst.String()}},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,16 +57,14 @@ func runTest(t *testing.T, pathPrefix string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if err, match := err.(*Error); match {
|
if err, match := err.(*Error); match {
|
||||||
println(err.Error())
|
println(err.Error())
|
||||||
if !err.Inst.IsNil() {
|
if len(err.Inst) != 0 {
|
||||||
err.Inst.Dump()
|
println(err.Inst)
|
||||||
println()
|
|
||||||
}
|
}
|
||||||
if len(err.Traceback) > 0 {
|
if len(err.Traceback) > 0 {
|
||||||
println("\ntraceback:")
|
println("\ntraceback:")
|
||||||
for _, line := range err.Traceback {
|
for _, line := range err.Traceback {
|
||||||
println(line.Pos.String() + ":")
|
println(line.Pos.String() + ":")
|
||||||
line.Inst.Dump()
|
println(line.Inst)
|
||||||
println()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
|||||||
// how this function got called.
|
// how this function got called.
|
||||||
callErr.Traceback = append(callErr.Traceback, ErrorLine{
|
callErr.Traceback = append(callErr.Traceback, ErrorLine{
|
||||||
Pos: getPosition(inst.llvmInst),
|
Pos: getPosition(inst.llvmInst),
|
||||||
Inst: inst.llvmInst,
|
Inst: inst.String(),
|
||||||
})
|
})
|
||||||
return nil, mem, callErr
|
return nil, mem, callErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1289,16 +1289,14 @@ func printCompilerError(logln func(...interface{}), err error) {
|
|||||||
case *interp.Error:
|
case *interp.Error:
|
||||||
logln("#", err.ImportPath)
|
logln("#", err.ImportPath)
|
||||||
logln(err.Error())
|
logln(err.Error())
|
||||||
if !err.Inst.IsNil() {
|
if len(err.Inst) != 0 {
|
||||||
err.Inst.Dump()
|
logln(err.Inst)
|
||||||
logln()
|
|
||||||
}
|
}
|
||||||
if len(err.Traceback) > 0 {
|
if len(err.Traceback) > 0 {
|
||||||
logln("\ntraceback:")
|
logln("\ntraceback:")
|
||||||
for _, line := range err.Traceback {
|
for _, line := range err.Traceback {
|
||||||
logln(line.Pos.String() + ":")
|
logln(line.Pos.String() + ":")
|
||||||
line.Inst.Dump()
|
logln(line.Inst)
|
||||||
logln()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case loader.Errors:
|
case loader.Errors:
|
||||||
|
|||||||
Reference in New Issue
Block a user