Skip to content

Commit

Permalink
Adding a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
marco6 authored and aykevl committed May 13, 2024
1 parent cef2a82 commit 71878c2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion interp/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,20 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
if err != nil {
return nil, mem, r.errorAt(inst, err)
}
// typecodePtr always point to the numMethod field in the type
// description struct. The methodSet, when present, comes right
// before the numMethod field (the compiler doesn't generate
// method sets for concrete types without methods).
// Considering that the compiler doesn't emit interface type
// asserts for interfaces with no methods (as the always succeed)
// then if the offset is zero, this assert must always fail.
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
return nil, mem, r.errorAt(inst, err)
}
methodSetPtr, err := mem.load(typecodePtrOffset, r.pointerSize).asPointer(r)
if err != nil {
Expand Down

0 comments on commit 71878c2

Please sign in to comment.