Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtend2 boolean switch(xtend2)
icon5.gif  xtend2 boolean switch [message #666866] Sat, 23 April 2011 16:22 Go to next message
Nicolas Cornaglia is currently offline Nicolas CornagliaFriend
Messages: 6
Registered: July 2009
Junior Member
Hi.
I'm migrating from xpand to xpand2(M6), but when I use this switch with a boolean (from a xtext generated model):
switch (entity.booleanProperty) {
    case false: '''It's false'''
    default: '''default'''
}

The generated class is:
boolean matched = false;
if (!matched) {
    if (false) {
        matched=true;
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder.append("It\'s false");
        _switchResult = _builder;
    }
}

So, the code is never executed...
Is this a bug or I'm doing something wrong?
TIA,
Nico.
Re: xtend2 boolean switch [message #666869 is a reply to message #666866] Sat, 23 April 2011 17:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

from Xbase docs
Quote:

Expressions of type java.lang.Boolean are not allowed in a switch expression.



~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtend2 boolean switch [message #666878 is a reply to message #666869] Sat, 23 April 2011 19:01 Go to previous message
Nicolas Cornaglia is currently offline Nicolas CornagliaFriend
Messages: 6
Registered: July 2009
Junior Member
Oooops... Next time will RTFM.
Thanks for answer!
Previous Topic:How to create a builder without ui
Next Topic:Using Xtext for custom conditional expressions on BPMN
Goto Forum:
  


Current Time: Sat Apr 20 02:00:43 GMT 2024

Powered by FUDForum. Page generated in 0.02253 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top