mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 12:33:42 +00:00
interp: error location for "unknown GEP" error
This commit removes a panic and replaces it with a proper source location. The message still isn't very helpful, but at least it points to a location in the source code. I'm not very happy with all the `err.Error()` calls, but that's the way to fit this in a `scanner.Error`. Eventually we should make a replacement for `scanner.Error` that does proper wrapping of the original error message.
This commit is contained in:
committed by
Ron Evans
parent
ec467da83c
commit
25cff20117
+5
-1
@@ -24,7 +24,11 @@ func getStringBytes(strPtr Value, strLen llvm.Value) []byte {
|
||||
}
|
||||
buf := make([]byte, strLen.ZExtValue())
|
||||
for i := range buf {
|
||||
c := strPtr.GetElementPtr([]uint32{uint32(i)}).Load()
|
||||
gep, err := strPtr.GetElementPtr([]uint32{uint32(i)})
|
||||
if err != nil {
|
||||
panic(err) // TODO
|
||||
}
|
||||
c := gep.Load()
|
||||
buf[i] = byte(c.ZExtValue())
|
||||
}
|
||||
return buf
|
||||
|
||||
Reference in New Issue
Block a user