mirror of
https://github.com/open-goal/jak-project
synced 2026-08-10 19:17:55 -04:00
deftype and defmethod syntax major changes (#3094)
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
This commit is contained in:
@@ -70,11 +70,11 @@ A "connection" is really just a function that gets called when the engine runs,
|
||||
:size-assert #x20
|
||||
:flag-assert #xe00000020
|
||||
(:methods
|
||||
(get-engine (connection) engine 9)
|
||||
(get-process (connection) process 10)
|
||||
(belongs-to-engine? (connection engine) symbol 11)
|
||||
(belongs-to-process? (connection process) symbol 12)
|
||||
(move-to-dead (connection) connection 13)
|
||||
(get-engine (connection) engine)
|
||||
(get-process (connection) process)
|
||||
(belongs-to-engine? (connection engine) symbol)
|
||||
(belongs-to-process? (connection process) symbol)
|
||||
(move-to-dead (connection) connection)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -104,24 +104,24 @@ A "connection" is really just a function that gets called when the engine runs,
|
||||
:size-assert #x60
|
||||
:flag-assert #x1a00000060
|
||||
(:methods
|
||||
(new (symbol type symbol int type) _type_ 0)
|
||||
(inspect-all-connections (engine) engine 9)
|
||||
(apply-to-connections (engine (function connectable none)) int 10)
|
||||
(apply-to-connections-reverse (engine (function connectable none)) int 11)
|
||||
(execute-connections (engine object) int 12)
|
||||
(execute-connections-and-move-to-dead (engine object) int 13)
|
||||
(execute-connections-if-needed (engine object) int 14)
|
||||
(add-connection (engine process object object object object) connection 15)
|
||||
(remove-from-process (engine process) int 16)
|
||||
(remove-matching (engine (function connection engine symbol)) int 17)
|
||||
(remove-all (engine) int 18)
|
||||
(remove-by-param0 (engine object) int 19)
|
||||
(remove-by-param1 (engine int) int 20)
|
||||
(remove-by-param2 (engine int) int 21)
|
||||
(get-first-connectable (engine) connectable 22)
|
||||
(get-last-connectable (engine) connectable 23)
|
||||
(get-next-connectable (_type_ connectable) connectable 24)
|
||||
(get-prev-connectable (_type_ connectable) connectable 25)
|
||||
(new (symbol type symbol int type) _type_)
|
||||
(inspect-all-connections (engine) engine)
|
||||
(apply-to-connections (engine (function connectable none)) int)
|
||||
(apply-to-connections-reverse (engine (function connectable none)) int)
|
||||
(execute-connections (engine object) int)
|
||||
(execute-connections-and-move-to-dead (engine object) int)
|
||||
(execute-connections-if-needed (engine object) int)
|
||||
(add-connection (engine process object object object object) connection)
|
||||
(remove-from-process (engine process) int)
|
||||
(remove-matching (engine (function connection engine symbol)) int)
|
||||
(remove-all (engine) int)
|
||||
(remove-by-param0 (engine object) int)
|
||||
(remove-by-param1 (engine int) int)
|
||||
(remove-by-param2 (engine int) int)
|
||||
(get-first-connectable (engine) connectable)
|
||||
(get-last-connectable (engine) connectable)
|
||||
(get-next-connectable (_type_ connectable) connectable)
|
||||
(get-prev-connectable (_type_ connectable) connectable)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -609,13 +609,13 @@ A "connection" is really just a function that gets called when the engine runs,
|
||||
:size-assert #x20
|
||||
:flag-assert #xf00000020
|
||||
(:methods
|
||||
(new (symbol type symbol int type) _type_ 0)
|
||||
(schedule-callback (_type_ object time-frame) connection-pers 9)
|
||||
(kill-callback (_type_ connection-pers) none 10)
|
||||
(kill-by-key (_type_ object) none 11)
|
||||
(kill-matching (_type_ (function engine-pers connection-pers object object symbol) object object) none 12)
|
||||
(update-callback (_type_) none 13)
|
||||
(run-pending-updates! (_type_ time-frame) none 14)
|
||||
(new (symbol type symbol int type) _type_)
|
||||
(schedule-callback (_type_ object time-frame) connection-pers)
|
||||
(kill-callback (_type_ connection-pers) none)
|
||||
(kill-by-key (_type_ object) none)
|
||||
(kill-matching (_type_ (function engine-pers connection-pers object object symbol) object object) none)
|
||||
(update-callback (_type_) none)
|
||||
(run-pending-updates! (_type_ time-frame) none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user