UnderminersTeam / UndertaleModTool

The most complete tool for modding, decompiling and unpacking Undertale (and other GameMaker games!)
GNU General Public License v3.0
1.19k stars 233 forks source link

UML compiler missing static keyword #1917

Open ChronoVortex opened 2 months ago

ChronoVortex commented 2 months ago

Describe the bug

Attempting to make changes to the decompiled gml_GlobalScript_scrScore code file in the latest Void War release throws the following error:

---------------------------
Compiler error
---------------------------
Errors parsing code when trying to compile modified "gml_GlobalScript_scrScore":

Expected assignment operator around line 440, column 16 (getAllCrewData).

Expected assignment operator around line 473, column 16 (getShipData).

Expected assignment operator around line 477, column 20 (getSysData).

Expected assignment operator around line 499, column 20 (getWeapons).

Unexpected token in expression around line 520, column 13.

Malformed assignment statement.

Expected assignment operator around line 522, ...
---------------------------
OK   
---------------------------

The code referenced by the error: generate_score_data.txt

Reproducing steps

Fix struct keyword issue in #1916 as specified in this comment, then attempt to make modifications to the code and recompile.

Setup Details

  1. Latest from underanalyzer branch (8c5462c)
  2. Windows 10
  3. Void War Alpha Patch #​2 (https://tundra-interactive.itch.io/void-war)
ChronoVortex commented 2 months ago

After messing with a few more functions, it seems like there may be something wrong with the way the compiler handles the static keyword, in particular when declaring a static variable and assigning a function to it

function someOuterFunction(argument0)
{
  static someInnerFunction = function(argument0)
  {
    return argument0;
  };
  return argument0;
}
ChronoVortex commented 2 months ago

Confirming that the compiler is missing implementation for the static keyword