Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » switch-case null issue
switch-case null issue [message #633645] Mon, 18 October 2010 16:36 Go to next message
Henning is currently offline HenningFriend
Messages: 32
Registered: October 2010
Member
Hi,

I encountered a strange behavior inside a switch-case statement. It comes down to this.

rule exampleTrafo
	transform d : Source!Domain
	to d : Target!Domain{

	var choice = "bigDecision";

	switch(choice){
		case "bigDecision" : 
			var temp = createSomething();
			if(not temp.isDefined())
				"ohh boy".println();
	}
}

operation createSomething() : Target!Element1{
	var returnValue = new Target!Element1;
	if(returnValue.isDefined())
		"I'm ready to go".println();
	return returnValue;
}


I would expect to get a plain "I'm ready to go" , unfortunately I get the following output:

Buildfile: /Users/henning/Documents/workspaces/diplom/my.example/launch .xml

loadModels:

main:
[epsilon.etl - exampleTrafo.etl] I'm ready to go
[epsilon.etl - exampleTrafo.etl] ohh boy
BUILD SUCCESSFUL
Total time: 246 milliseconds

Is this behavior intended?

Best regards,

Henning
Re: switch-case null issue [message #633665 is a reply to message #633645] Mon, 18 October 2010 18:12 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Henning,

Thanks for reporting this! You've uncovered another bug it seems! I've
located the problem and will fix it shortly. In the meantime, when you
perform an assignment within a case "x" please use := instead of =

e.g. var temp := createSomething();

Cheers,
Dimitris

On 18/10/2010 17:36, Henning wrote:
> Hi,
>
> I encountered a strange behavior inside a switch-case statement. It
> comes down to this.
>
>
> rule exampleTrafo
> transform d : Source!Domain
> to d : Target!Domain{
>
> var choice = "bigDecision";
>
> switch(choice){
> case "bigDecision" : var temp = createSomething();
> if(not temp.isDefined())
> "ohh boy".println();
> }
> }
>
> operation createSomething() : Target!Element1{
> var returnValue = new Target!Element1;
> if(returnValue.isDefined())
> "I'm ready to go".println();
> return returnValue;
> }
>
>
> I would expect to get a plain "I'm ready to go" , unfortunately I get
> the following output:
>
> Buildfile: /Users/henning/Documents/workspaces/diplom/my.example/launch
> .xml
>
> loadModels:
>
> main:
> [epsilon.etl - exampleTrafo.etl] I'm ready to go
> [epsilon.etl - exampleTrafo.etl] ohh boy
> BUILD SUCCESSFUL
> Total time: 246 milliseconds
>
> Is this behavior intended?
>
> Best regards,
>
> Henning
Previous Topic:onefile="true" doesn't seem to work
Next Topic:Automatic validation.
Goto Forum:
  


Current Time: Sun Nov 23 03:55:56 GMT 2014

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

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