Last active
June 13, 2019 20:44
-
-
Save joseoliv/481f7e16d7d465d2ffc110cd190ee98b to your computer and use it in GitHub Desktop.
createPrototype
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 'createPrototype' creates one or two prototypes in the | |
current package given their names. It can be used | |
@createPrototype(prototypeName1, codeForPrototypeName1) | |
or | |
@createPrototype(prototypeName1, codeForPrototypeName1, | |
prototypeName2, codeForPrototypeName2) | |
prototypeName1 is created in phase dpa, and | |
prototypeName2 is created in phase afti. | |
*} | |
object CreatePrototype | |
@createPrototype( | |
"Dragon", | |
"package metaobjectTest\nobject Dragon\n func get -> Int { return 0 }\n\nend", | |
"Elf", | |
"package metaobjectTest\nobject Elf\n func get -> String { return \"Elf !\" }\n\nend" | |
) | |
func run { | |
let Dragon dragon = Dragon new; | |
assert dragon get == 0; | |
assert Elf() get == "Elf !"; | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment