Enumeration arguments in operations [message #573982] |
Wed, 12 August 2009 17:16 |
|
Hello all,
I've defined an operation which takes an enumeration literal as a
parameter. Oddly enough, it doesn't work when I declare it as such. It
does work when I declare that parameter to be of type Any.
For testing, I've defined an Ecore model whose Emfatic source looks like
this:
@namespace(uri="testEnumArgs", prefix="ea")
package EnumArgs;
enum Color {
RED;
BLUE;
}
If I run the following EOL script against an empty model which conforms
to the previous metamodel, the first call works, but the second reports
"Type 'Color' not found":
toggle(Color#RED).println('Color A: ');
brokenToggle(Color#RED).println('Color A: ');
operation toggle(color : Any) {
if (color = Color#RED) {
return Color#BLUE;
} else {
return Color#RED;
}
}
operation brokenToggle(color : Color) {
if (color = Color#RED) {
return Color#BLUE;
} else {
return Color#RED;
}
}
Is this a bug, or am I doing something wrong?
Just in case, I've submitted a bug with a sample project which
reproduces the issue:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286412
Regards,
Antonio
|
|
|
Powered by
FUDForum. Page generated in 0.02820 seconds