Skip to content

InstanceRef returned for a closure is not valid #37989

@grouma

Description

@grouma

The InstanceRef returned for a bound closure contains fields closureFunction and closureContext. However, these fields are only valid for an actual Instance.

Example returned BoundVariable:

{"type":"BoundVariable","name":"b","value":{"type":"@Instance","_vmType":"Closure","class":{"type":"@Class","fixedId":true,"id":"classes\/46","name":"_Closure","_vmName":"_Closure@0150898"},"kind":"Closure","id":"objects\/10","closureFunction":{"type":"@Function","fixedId":true,"id":"classes\/1099\/implicit_closures\/1","name":"staticOnClass","owner":{"type":"@Function","fixedId":true,"id":"classes\/1099\/functions\/staticOnClass","name":"staticOnClass","owner":{"type":"@Class","fixedId":true,"id":"classes\/1099","name":"Foo"},"_kind":"RegularFunction","static":true,"const":false,"_intrinsic":false,"_native":false},"_kind":"ImplicitClosureFunction","static":true,"const":false,"_intrinsic":false,"_native":false},"closureContext":{"type":"@Instance","_vmType":"Context","class":{"type":"@Class","fixedId":true,"id":"classes\/141","name":"Null"},"kind":"Null","fixedId":true,"id":"objects\/null","valueAsString":"null"}},"declarationTokenPos":714,"scopeStartTokenPos":723,"scopeEndTokenPos":891},{"type":"BoundVariable","name":"c","value":{"type":"@Instance","_vmType":"Closure","class":{"type":"@Class","fixedId":true,"id":"classes\/46","name":"_Closure","_vmName":"_Closure@0150898"},"kind":"Closure","id":"objects\/11","closureFunction":{"type":"@Function","fixedId":true,"id":"classes\/1099\/implicit_closures\/2","name":"instanceMethod","owner":{"type":"@Function","fixedId":true,"id":"classes\/1099\/functions\/instanceMethod","name":"instanceMethod","owner":{"type":"@Class","fixedId":true,"id":"classes\/1099","name":"Foo"},"_kind":"RegularFunction","static":false,"const":false,"_intrinsic":false,"_native":false},"_kind":"ImplicitClosureFunction","static":false,"const":false,"_intrinsic":false,"_native":false},"closureContext":{"type":"@Context","id":"objects\/12","length":1}},"declarationTokenPos":745,"scopeStartTokenPos":756,"scopeEndTokenPos":891}

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.pkg-vm-servicevm-debugger

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions