Commit Graph

2 Commits

Author SHA1 Message Date
Bob Nystrom
6996f5a48d feat: replace per-type equality primitives with unified object_eqeq and wrenGetClass
Move equality and inequality primitives from Bool and Function to a single Object-level implementation using valuesEqual, and add wrenGetClass to return the runtime class of any value. Refactor newSingleClass to inherit methods from superclass and wire metaclass superclass to classClass. Add type-checking tests for all built-in types and class inheritance.
2013-11-26 15:52:37 +00:00
Bob Nystrom
266881994f feat: add is operator for type checking and refactor primitives registration
Add TOKEN_IS token and CODE_IS bytecode to support runtime type checking via the `is` keyword. Refactor primitive registration by replacing `registerPrimitives` with `loadCore`, which compiles a core library string to define built-in classes (Bool, Class, Function, Num, Null, String, IO) and then attaches primitive methods to them. Update Primitive typedef to remove unused numArgs parameter, and add findGlobal helper to retrieve globals by name. Include test files for class syntax, class instantiation, and the new `is` operator.
2013-11-08 01:07:32 +00:00