Retoor software development Projects Research SearchXNG
Register Sign In

10 lines
153 B
Plaintext
Raw Normal View History

feat: add foreign class support with allocation, construct opcodes, and CLI callback wiring Implement the initial infrastructure for foreign classes in the Wren VM, including new opcodes (FOREIGN_CONSTRUCT, FOREIGN_CLASS), a WrenBindForeignClassFn callback type in the public API, and updated CLI vm.c to store and forward foreign binding callbacks via setForeignCallbacks(). The compiler now tracks whether a class is foreign via a new isForeign flag in ClassCompiler, emits CODE_FOREIGN_CONSTRUCT instead of CODE_CONSTRUCT for foreign class constructors, and errors on field definitions inside foreign classes. The debug dump and opcode header gain entries for the new opcodes, and wrenBindSuperclass handles the -1 numFields sentinel for foreign classes to prevent field inheritance from superclasses.
2015-08-15 21:07:53 +02:00
foreign class Foo {
bar {
// Can't read a field.
IO.print(_bar) // expect error
// Or write one.
_bar = "value" // expect error
}
}
Reference in New Issue Copy Permalink
d2c8bacbaa
wren/test/language/class/field_in_foreign_class.wren
Response time: 53ms
Mail Licenses API