jak-project/goalc/compiler/compilation
ManDude fe491c2b5e
[opengoal] make none a child of object (#3001)
Previously, `object` and `none` were both top-level types. This made
decompilation rather messy as they have no LCA and resulted in a lot of
variables coming out as type `none` which is very very wrong and
additionally there were plenty of casts to `object`. This changes it so
`none` becomes a child of `object` (it is still represented by
`NullType` which remains unusable in compilation).

This change makes `object` the sole top-level type, and the type that
can represent *any* GOAL object. I believe this matches the original
GOAL built-in type structure. A function that has a return type of
`object` can now return an integer or a `none` at the same time.
However, keep in mind that the return value of `(none)` is still
undefined, just as before. This also makes a cast to `object`
meaningless in 90% of the situations it showed up in (as every single
thing is already an `object`) and the decompiler will no longer emit
them. Casts to `none` are also reduced. Yay!

Additionally, state handlers also don't get the final `(none)` printed
out anymore. The return type of a state handler is completely
meaningless outside the event handler (which is return type `object`
anyway) so there are no limitations on what the last form needs to be. I
did this instead of making them return `object` to trick the decompiler
into not trying to output a variable to be used as a return value
(internally, in the decompiler they still have return type `none`, but
they have `object` elsewhere).

Fixes #1703 
Fixes #830 
Fixes #928
2023-09-22 10:54:49 +01:00
..
Asm.cpp [jak2] GOAL side texture animation stuff (#2766) 2023-06-24 10:11:47 -04:00
Atoms.cpp goalc: add macro-expand form (#3000) 2023-09-17 22:55:25 +02:00
Block.cpp [goalc] Address-to-line (#783) 2021-08-26 20:33:00 -04:00
CompilerControl.cpp i18n: subtitle code cleanup and update new subtitle JSON files to be compatible with Crowdin (#2802) 2023-07-09 02:53:39 +01:00
ConstantPropagation.cpp logs: replace every fmt::print with a lg call instead (#1368) 2022-10-01 11:58:36 -04:00
ControlFlow.cpp [opengoal] make none a child of object (#3001) 2023-09-22 10:54:49 +01:00
Debug.cpp dbgr: allow dumping the backtrace to a file (#2284) 2023-02-27 18:54:23 -05:00
Define.cpp [opengoal] make none a child of object (#3001) 2023-09-22 10:54:49 +01:00
Function.cpp [opengoal] make none a child of object (#3001) 2023-09-22 10:54:49 +01:00
Macro.cpp goalc: add macro-expand form (#3000) 2023-09-17 22:55:25 +02:00
Math.cpp less branches for division + fix divide by zeros (#2585) 2023-04-29 21:10:51 +01:00
State.cpp lint: add include sorting config to clang-format (#1517) 2022-06-22 23:37:46 -04:00
Static.cpp [decomp] ctywide-obs (#2250) 2023-02-25 14:00:16 -05:00
Type.cpp [opengoal] make none a child of object (#3001) 2023-09-22 10:54:49 +01:00