Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created June 25, 2019 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/e40e3c4ce935fa78b70acd5366dbaf16 to your computer and use it in GitHub Desktop.
Save joseoliv/e40e3c4ce935fa78b70acd5366dbaf16 to your computer and use it in GitHub Desktop.
shouldCallSuperMethod
package metaobjectTest
@doc{*
Metaobject 'shouldCallSuperMethod' is an action function. Its
associated metaobject declares a method 'eval' that may be
called by other metaobjects. It cannot be associated to
an annotation:
// compile-time error
@shouldCallSuperMethod
This action function can be called by method 'call:' of
Myan or Tyan (interpreted Cyan) or by the following
statements:
WrEnv env = compiler.getEnv();
IActionFunction f = env.searchActionFunction("shouldCallSuperMethod");
f.eval(input);
'input' is a saci.Tuple6 (saci is a Cyan Compiler package) whose elements
are:
- the compiler passed as parameter to a metaobject method
- the metaobject
- the list of annotation parameters
- a symbol to be used if there is an error
- the current method
- the environment
All of these parameters are automatically passed when using method
'call:' of Myan or Tyan, as in the example of annotation 'onOverride'
below.
*}
open
object ShouldCallSuperMethod
@onOverride{*
// the overridden method should call
// this method in its first statement
// shouldCallSuperMethod is an action function
// of package cyan.lang
call: #shouldCallSuperMethod;
*}
func run {
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment