jak-project/goalc
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
..
build_level game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00
compiler [goalc] default to non-immediate lambdas if not requested (#2604) 2023-04-30 19:00:27 -04:00
data_compiler i18n: init translation files that can be used by crowdin (#1760) 2023-04-30 17:22:56 -04:00
debugger game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00
emitter game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00
listener game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00
make i18n: init translation files that can be used by crowdin (#1760) 2023-04-30 17:22:56 -04:00
regalloc [goalc] reduce compiler memory usage (#2247) 2023-02-24 18:32:30 -05:00
CMakeLists.txt docs: Automatically generate documentation from goal_src code (#2214) 2023-02-20 19:49:37 -05:00
main.cpp game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00
simple_main.cpp game: Remove temporary CLI arg shim in gk (#2532) 2023-04-22 14:13:57 -04:00