mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04: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. |
||
---|---|---|
.. | ||
align16-1.static.gc | ||
align16-2.static.gc | ||
conditional-compilation.static.gc | ||
declare-inline.static.gc | ||
defsmacro-defgmacro.static.gc | ||
defun-return-constant.static.gc | ||
defun-return-symbol.static.gc | ||
desfun.static.gc | ||
dotimes.static.gc | ||
factorial-iterative.static.gc | ||
factorial-recursive.static.gc | ||
function-returning-none.static.gc | ||
goto.static.gc | ||
inline-call.static.gc | ||
inline-with-block-1.static.gc | ||
inline-with-block-2.static.gc | ||
inline-with-block-3.static.gc | ||
inline-with-block-4.static.gc | ||
lambda-1.static.gc | ||
methods.static.gc | ||
nested-blocks-1.static.gc | ||
nested-blocks-2.static.gc | ||
nested-blocks-3.static.gc | ||
nested-call.static.gc | ||
protect.static.gc | ||
return-arg.static.gc | ||
return-colors.static.gc | ||
return-from-trick.static.gc | ||
return-value-of-if.static.gc | ||
return.static.gc | ||
set-symbol.static.gc | ||
simple-call.static.gc |