Created
June 25, 2019 03:58
-
-
Save joseoliv/9885034f7c9e7235d62af4640e9fde48 to your computer and use it in GitHub Desktop.
getPackageValueFromKey
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 '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