This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var String funcName; | |
func afti_beforeMethodCodeList { | |
return [ [. MetSig, "fp = \"c\";".], [. UMS, "unaryReturn = Ret;" .] ]; | |
} | |
func afti_codeToAdd { | |
var java.lang.String ssi = "func succ: Int n -> Int"; | |
var String s = ssi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
This metaobject works like action_afti_dsa but the | |
Myan code is read from the file that is the first parameter. So, instead | |
of putting the Myan code attached to the annotation, it is read from | |
the file, which may be preceded by a package name. The file should have | |
extension myan and be in the –-data directory of the package. Usage example: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
Annotation 'rpn' takes an expression in Reverse Polish Notation (RPN) | |
in the attached DSL and evaluates it at compile-time. The annotation | |
is an expression of type Int. Only positive integer numbers are allowed | |
in the RPN expression. | |
This is a demonstration metaobject. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
open | |
object SubRestrictOverrideTo extends metaobjectTest.RestrictOverrideTo | |
override | |
func myprint { } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
Annotation 'restrictOverrideTo' should be attached to | |
a method. Its parameter list is composed of prototype names, | |
with the package. The annotated method can only be | |
overridden in those prototypes. | |
*} | |
open | |
object RestrictOverrideTo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
object ImplementRestrictImplementation implements RestrictImplementation | |
func run { | |
} | |
override | |
func myprint { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
Annotation 'restrictImplementation' should be attached to | |
an interface. Its parameter list is composed of prototypes. | |
The interface can only be implemented by prototypes that | |
are in the list or its subprototypes. | |
*} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
Annotation 'renameMethod' should be attached to a prototype. | |
It takes at least two parameters: the first is a method name | |
and the others are the new selectors for the method. Example: | |
@renameMethod("at:1 with:2", "myAt:", "myWith:") | |
This annotation will rename method "at:1 with: 2" to "myAt:1 myWith:2". | |
Overloaded methods cannot be renamed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
Annotation 'readOnly' should be attached to a method. | |
It assures that there is no assignment to either | |
shared or non-shared fields inside the method. | |
Note that does not guarantee that the method does | |
not change the receiver fields (self fields). These | |
can be changed by methods called by the attached method: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
@doc{* | |
Annotation 'prototypeCallOnly' should be attached to a method. | |
It assures that the method is only called with a prototype | |
as receiver. This is a replacement for 'static' methods | |
of Java/C++/C#. An annotated method cannot access | |
non-shared fields and it should be final (either | |
declared with 'final' or the prototype is final). |