Checking for methodset existance

This commit is contained in:
Marco Manino
2024-02-13 17:48:19 +01:00
committed by Ayke
parent 1d9f26cee1
commit cef2a82c97
2 changed files with 15 additions and 0 deletions
+4
View File
@@ -427,6 +427,10 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
if err != nil {
return nil, mem, r.errorAt(inst, err)
}
if typecodePtr.offset() == 0 {
locals[inst.localIndex] = literalValue{uint8(0)}
break
}
typecodePtrOffset, err := typecodePtr.addOffset(-int64(r.pointerSize))
if err != nil {
return nil, mem, r.errorAt(inst, err) // unlikely
+11
View File
@@ -109,3 +109,14 @@ func sliceString(s string, start, end int) string {
func sliceSlice(s []int, start, end int) []int {
return s[start:end]
}
type outside struct{}
func init() {
_, _ = any(0).(interface{ DoesNotExist() })
_, _ = any("").(interface{ DoesNotExist() })
_, _ = any(outside{}).(interface{ DoesNotExist() })
type inside struct{}
_, _ = any(inside{}).(interface{ DoesNotExist() })
}