feat: implement class method definition and instance creation in compiler and VM
Add method parsing and compilation in `statement()` for class bodies, including symbol interning and block constant emission. Introduce `addConstant()` helper in compiler.c. Extend VM with `CODE_METHOD` opcode, `ObjInstance` type, `makeInstance()` factory, metaclass support in `makeClass()`, and `getSymbolName()` for symbol table lookup. Update vm.h with new type enum, struct definitions, and function declarations.
This commit is contained in:
+6
-5
@@ -1,6 +1,7 @@
|
||||
var a = {
|
||||
var b = 234
|
||||
3
|
||||
b
|
||||
class Foo {
|
||||
bar {
|
||||
123
|
||||
}
|
||||
}
|
||||
a.call
|
||||
var a = Foo.new
|
||||
a.bar
|
||||
|
||||
Reference in New Issue
Block a user