jak-project/test/goalc/source_templates
water111 ef23fecd90
[goalc] default to non-immediate lambdas if not requested (#2604)
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.
2023-04-30 19:00:27 -04:00
..
arithmetic [goalc] fix mod bug and add div tests (#1296) 2022-04-11 20:53:24 -04:00
collections Make all tests hermetic, only the tests with kernel left 2020-10-09 13:23:41 -04:00
control-statements [goalc] default to non-immediate lambdas if not requested (#2604) 2023-04-30 19:00:27 -04:00
jak2 [goalc] Fix error when putting #f in an array of symbols (#1804) 2022-08-26 15:54:29 -04:00
kernel add support for non virtual states (#764) 2021-08-17 20:54:03 -04:00
variables support inline arrays on stack (#726) 2021-07-26 21:39:05 -04:00
with_game [decomp] ctywide-obs (#2250) 2023-02-25 14:00:16 -05:00