mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-27 00:10:31 +00:00
ef23fecd90
This fixes a long time issue with `lambda`. The `lambda` is a bit overloaded in OpenGOAL: it's used in the implementation of `let`, and also to define local anonymous functions. ``` (defmacro let (bindings &rest body) `((lambda :inline #t ,(apply first bindings) ,@body) ,@(apply second bindings))) ``` ``` (defmacro defun (name bindings &rest body) (let ((docstring "")) (when (and (> (length body) 1) (string? (first body))) (set! docstring (first body)) (set! body (cdr body))) `(define ,name ,docstring (lambda :name ,name ,bindings ,@body)))) ``` In the first case of a `let`, a `return` from inside the `let` should return from the functioning containing the `let`, not the scope of the `lambda`. In the second case, we should return from the lambda. The way we told the different between these cases was if the `lambda` was used "immeidately", in the head of an expression (like it would be for the `let` macro). But, this falsely triggers when an anonymous function is used immediately: eg ``` ((lambda () (return #f))) ``` should generate and call a real x86 function that returns immediately. This should fix some death/mission failed stuff in jak 2. |
||
---|---|---|
.. | ||
build_level | ||
compiler | ||
data_compiler | ||
debugger | ||
emitter | ||
listener | ||
make | ||
regalloc | ||
CMakeLists.txt | ||
main.cpp | ||
simple_main.cpp |