jak-project/test/goalc/source_templates/control-statements
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
..
align16-1.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
align16-2.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
conditional-compilation.static.gc Copy over LISP code 2020-10-08 00:05:01 -04:00
declare-inline.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
defsmacro-defgmacro.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
defun-return-constant.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
defun-return-symbol.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
desfun.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
dotimes.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
factorial-iterative.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
factorial-recursive.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
function-returning-none.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
goto.static.gc Copy over LISP code 2020-10-08 00:05:01 -04:00
inline-call.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
inline-with-block-1.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
inline-with-block-2.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
inline-with-block-3.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
inline-with-block-4.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
lambda-1.static.gc [goalc] default to non-immediate lambdas if not requested (#2604) 2023-04-30 19:00:27 -04:00
methods.static.gc [Compiler] Bug fixes (#230) 2021-02-03 11:07:47 -05:00
nested-blocks-1.static.gc Copy over LISP code 2020-10-08 00:05:01 -04:00
nested-blocks-2.static.gc Copy over LISP code 2020-10-08 00:05:01 -04:00
nested-blocks-3.static.gc Copy over LISP code 2020-10-08 00:05:01 -04:00
nested-call.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
protect.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
return-arg.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
return-colors.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
return-from-trick.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
return-value-of-if.static.gc Make all tests hermetic, only the tests with kernel left 2020-10-09 13:23:41 -04:00
return.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
set-symbol.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00
simple-call.static.gc [Decompiler] Begin expression conversion, rearrange tests (#209) 2021-01-23 16:32:56 -05:00