Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
getPackageValueFromKey
package metaobjectTest
@doc{*
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
program
// 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";
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.