Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package metaobjectTest
Annotations of this metaobject should be attached to a method or
method signature (of an interface).
The attached DSL code is made in Myan, which supports interpreted Cyan
within parameterless methods declared with 'func':
func afti_codeToAdd {
// interpreted Cyan code
According to the method name, the Cyan code is interpreted in phase
afti or dsa. Methods of interfaces
can be implemented. To better understand this, see the documentation
for action_afti_dsa.
object OnMessageSend_afsa
func run {
var Int k = 0;
// error if uncommented: the first parameter should be literal
// self at: k, "";
// ok
self at: 5, "";
This annotation demands that the first parameter to
the message passing should be a literal Int
func afsa_checkKeywordMessageSend {
// first parameter
var expr = (message getkeywordParameterList
get: 0) getExprList get: 0;
if ! (Null instanceof: expr, "meta.WrExprLiteral") {
var s = message getFirstSymbol;
var Int lineNumber = s getLineNumber;
var String fn = s getCompilationUnit getFullFileNamePath;
metaobject addError: "In line " ++ lineNumber ++ " of file " ++
fn ++ ": the first parameter to this " ++
"message passing should be a literal Int"
func at: Int n, String s {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment