mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -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. |
||
---|---|---|
.. | ||
framework | ||
source_generated | ||
source_templates | ||
CMakeLists.txt | ||
README.md | ||
test_arithmetic.cpp | ||
test_collections.cpp | ||
test_compiler.cpp | ||
test_control_statements.cpp | ||
test_debugger.cpp | ||
test_game_no_debug.cpp | ||
test_goal_kernel.cpp | ||
test_goal_kernel2.cpp | ||
test_jak2_compiler.cpp | ||
test_type_consistency.cpp | ||
test_variables.cpp | ||
test_vector_float.cpp | ||
test_with_game.cpp |
Some Documentation
TODO!
TODO
- If it can't make the file successfully, currently the tests just hang
- How do i share the same fixture (compiler/thread instance), but with different Params. I don't think this is possible...maybe with templates?