Commit Graph
5 Commits
Author SHA1 Message Date
Peter Reijnders 875c74b211 fix: align ObjList capacity and count types with ObjMap's uint32_t
Change the `capacity` and `count` fields in `ObjList` from `int` to `uint32_t` to match the
types used in `ObjMap`, ensuring consistency between the two structures. Update all loop
variables and index calculations in `wren_core.c` and `wren_value.c` that interact with
these fields to use `uint32_t` instead of `int`, and remove the now-unnecessary negative
bounds check in `list_iterate` since unsigned types cannot be negative.
2015-03-08 11:33:29 +00:00
Peter Reijnders 0ddef2c17f chore: enable -Wextra compiler flag and suppress unused-parameter warnings
Enable the -Wextra compiler flag in the wren.mk build configuration, which was previously commented out with a TODO. To handle the new unused parameter warnings triggered by -Wextra (particularly for WrenVM* vm parameters in several functions), add -Wno-unused-parameter to suppress them. Also fix a declaration ordering issue in wren_vm.c where the 'static' keyword was placed after the return type in loadIntoCore, moving it to the correct position before the type specifier.
2015-02-28 12:52:48 +00:00
Peter Reijnders 21e387efec fix: add null and already-freed guard to wrenFreeVM to prevent double-free crash
The guard checks if the VM pointer is NULL or if its methodNames count is zero,
which serves as a heuristic to detect an already-freed VM instance. This prevents
a segmentation fault or memory corruption when wrenFreeVM is called multiple times
on the same VM object.
2015-02-28 12:29:17 +00:00
Peter Reijnders 3987db35f7 feat: prevent subclassing of built-in types with runtime error in class creation
Add a check in the interpreter's class creation path that detects when a user-defined class attempts to inherit from any of the seven built-in types (Class, Fiber, Fn, List, Map, Range, String). When such an inheritance is detected, a runtime error is raised with a descriptive message indicating the class name and that it may not subclass a built-in. This implements the restriction discussed in issue #70.

Also adds test files for each built-in type to verify the runtime error is correctly triggered, and includes a commented-out test for closure subclassing that currently causes a segfault.
2015-02-25 19:13:37 +00:00
Peter Reijnders 65366b49d1 feat: add shared library build targets for libwren.so and libwrend.so
Extend the Makefile to produce both static (.a) and shared (.so) library variants for debug and release configurations, updating the clean target and .gitignore accordingly.
2015-01-27 14:05:53 +00:00