Skip to content

Commit 58fafae

Browse files
kenbellaykevl
authored andcommitted
build: #3893 do not return LLVM structs from Build
1 parent 13a8eae commit 58fafae

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

interp/errors.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ func isRecoverableError(err error) bool {
3535
// ErrorLine is one line in a traceback. The position may be missing.
3636
type ErrorLine struct {
3737
Pos token.Position
38-
Inst llvm.Value
38+
Inst string
3939
}
4040

4141
// Error encapsulates compile-time interpretation errors with an associated
4242
// import path. The errors may not have a precise location attached.
4343
type Error struct {
4444
ImportPath string
45-
Inst llvm.Value
45+
Inst string
4646
Pos token.Position
4747
Err error
4848
Traceback []ErrorLine
@@ -60,10 +60,10 @@ func (r *runner) errorAt(inst instruction, err error) *Error {
6060
pos := getPosition(inst.llvmInst)
6161
return &Error{
6262
ImportPath: r.pkgName,
63-
Inst: inst.llvmInst,
63+
Inst: inst.String(),
6464
Pos: pos,
6565
Err: err,
66-
Traceback: []ErrorLine{{pos, inst.llvmInst}},
66+
Traceback: []ErrorLine{{pos, inst.String()}},
6767
}
6868
}
6969

interp/interp_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,14 @@ func runTest(t *testing.T, pathPrefix string) {
5757
if err != nil {
5858
if err, match := err.(*Error); match {
5959
println(err.Error())
60-
if !err.Inst.IsNil() {
61-
err.Inst.Dump()
62-
println()
60+
if len(err.Inst) != 0 {
61+
println(err.Inst)
6362
}
6463
if len(err.Traceback) > 0 {
6564
println("\ntraceback:")
6665
for _, line := range err.Traceback {
6766
println(line.Pos.String() + ":")
68-
line.Inst.Dump()
69-
println()
67+
println(line.Inst)
7068
}
7169
}
7270
}

interp/interpreter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
543543
// how this function got called.
544544
callErr.Traceback = append(callErr.Traceback, ErrorLine{
545545
Pos: getPosition(inst.llvmInst),
546-
Inst: inst.llvmInst,
546+
Inst: inst.String(),
547547
})
548548
return nil, mem, callErr
549549
}

main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,16 +1289,14 @@ func printCompilerError(logln func(...interface{}), err error) {
12891289
case *interp.Error:
12901290
logln("#", err.ImportPath)
12911291
logln(err.Error())
1292-
if !err.Inst.IsNil() {
1293-
err.Inst.Dump()
1294-
logln()
1292+
if len(err.Inst) != 0 {
1293+
logln(err.Inst)
12951294
}
12961295
if len(err.Traceback) > 0 {
12971296
logln("\ntraceback:")
12981297
for _, line := range err.Traceback {
12991298
logln(line.Pos.String() + ":")
1300-
line.Inst.Dump()
1301-
logln()
1299+
logln(line.Inst)
13021300
}
13031301
}
13041302
case loader.Errors:

0 commit comments

Comments
 (0)