GoTo Confused With Var Access in Scripts

Reporter: RobertBColton  |  Status: open  |  Last Modified: January 04, 2019, 05:54:06 AM

What I am reporting here is an issue pointed out to me by @DARKSTAR2 over Discord. goto is only working in object events and not scripts due to a parsing issue. For some reason, JDI is converting the label identifiers into a var access causing compile to fail. It's possible that some of sorlok's changes in #912 may be related as I notice that he did change how variables are collected with respect to goto.

goto my_special_label;
return 0;

my_special_label:
draw_text(0,0,"hello");
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_scr_0(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:16: error: expected ';' before '::' token
     goto enigma::varaccess_my_special_label(int(self));
                ^~
                ;
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:18: error: '::varaccess_my_special_label' has not been declared
     goto enigma::varaccess_my_special_label(int(self));
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:18: note: suggested alternative:
In file included from SHELLmain.cpp:105:
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectaccess.h:52:9: note:   'enigma::varaccess_my_special_label'
   var  &varaccess_my_special_label(int x)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from SHELLmain.cpp:106:
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:43:50: error: expected ';' before ':' token
     enigma::varaccess_my_special_label(int(self)):
                                                  ^
                                                  ;
C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:10: error: label 'enigma' used but not defined
     goto enigma::varaccess_my_special_label(int(self));
          ^~~~~~
RobertBColton  
I tested reverting #912 and it didn't change a thing.
Please sign in to post comments, or you can view this issue on GitHub.