In the following code, when undeclared is on, the references to method myhandler() and the function myhandler_func() used for subscribing to the event are seen as undeclared memvars, resulting to runtime errors about them not being defined.
Not sure if this can be distinguished by the compiler.
#pragma options (memvar,on)
#pragma options (undeclared,on)
#pragma options (fox2,off)
//#pragma options (fox2,on) // does not make a difference
CLASS TestClass
EVENT myEvent AS EventHandler
CONSTRUCTOR()
SELF:myEvent += EventHandler{ SELF , @myhandler() } // works OK
SELF:myEvent += SELF:myhandler // works OK
SELF:myEvent += myhandler // warning XS9073: Variable 'myhandler' has not been declared. Assuming this is a FIELD or a MEMVAR.
SELF:myEvent += EventHandler{ NULL , @myhandler_func() } // warning XS9073: Variable 'myhandler_func' has not been declared. Assuming this is a FIELD or a MEMVAR.
SELF:myEvent += myhandler_func // warning XS9073: Variable 'myhandler_func' has not been declared. Assuming this is a FIELD or a MEMVAR.
SELF:myEvent(NULL,NULL)
RETURN
METHOD myhandler(sender AS OBJECT , e AS EventArgs) AS VOID
? "invoked"
END CLASS
FUNCTION myhandler_func(sender AS OBJECT , e AS EventArgs) AS VOID
? "invoked"
FUNCTION Start( ) AS VOID
TestClass{}
RETURN
In the following code, when undeclared is on, the references to method myhandler() and the function myhandler_func() used for subscribing to the event are seen as undeclared memvars, resulting to runtime errors about them not being defined.
Not sure if this can be distinguished by the compiler.