Store the class name string in `ObjClass` during compilation and class creation, and expose it through a new `class_name` native method. Also update `object_toString` to return the class name for class instances and "instance of <name>" for regular instances.
10 lines
269 B
Plaintext
10 lines
269 B
Plaintext
class Foo {}
|
|
|
|
IO.print(Foo.name) // expect: Foo
|
|
IO.print(Foo.type.name) // expect: Foo metaclass
|
|
|
|
// Make sure the built-in classes have proper names too.
|
|
IO.print(Object.name) // expect: Object
|
|
IO.print(Class.name) // expect: Class
|
|
IO.print(Bool.name) // expect: Bool
|