Skip to content

Instantly share code, notes, and snippets.

Last active Nov 4, 2019
What would you like to do?
package metaobjectTest
Annotations of this metaobject are attached to a declaration. The
Cyan code attached to the annotation is run in phase afsa. Method
afsa_checkOverride of the class of metaobject onOverride,
overridden from ICheckOverride_afsa, just interpret the Cyan
statements attached to the annotation.
Then, in phase afsa of the compilation, the Tyan statements
attached to the annotation onOverride below are interpreted.
Tyan is interpreted Cyan.
To better understand this, see the documentation for action_afti_dsa.
object OnOverride
func run {
// the overridden method should call
// this method in its first statement
// shouldCallSuperMethod is an action function
// of package cyan.lang
call: #shouldCallSuperMethod;
/* print a warning message if method 'draw' is overridden in
a subprototype that does not declares a 'subMethod' method.
var Boolean found = false;
var methodList =
method getDeclaringObject getMethodDecList: (compiler getEnv);
for i in 0..< methodList size {
var String methodName = (methodList get: i) getName;
if methodName == "subMethod" {
found = true;
if !found {
var String protoName = method getDeclaringObject getName;
Out println: "Prototype " ++ method getDeclaringObject getName ++
" should have a 'subMethod' method";
func draw {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment