Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package metaobjectTest
Annotation 'GetPackageValueFromKey' is String expression. It is
"" if its parameter is not a key of the package of the current
prototype. If it is, the expression is the value associated to
the key in the package but transformed into a string by either
method toString of Java or method asString of Cyan.
object GetPackageValueFromKey
func run {
The project file, p.pyan, has the contents
@setVariable(debug, "yes")
@setVariable(author, "Jose")
// elided
// elided
@setVariable(test, create)
@setVariable(goal, "Test all metaobjects")
package metaobjectTest
// elided
The package variable 'test' is associated to
"create" (even without the quotes) and 'goal' to
"Test all metaobjects"
var String value = @getPackageValueFromKey(test);
assert value == "create";
value = @getPackageValueFromKey(goal);
assert value == "Test all metaobjects";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment