Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » guard variables scope
guard variables scope [message #899854] Thu, 02 August 2012 15:36 Go to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 156
Registered: October 2009
Senior Member

Hello,

In listing 6.8 of the epsilon book the moveTo variable is defined inside the guard and then used outside the guard. I tried this in an ETL rule, but the variable defined inside my guard is not recognized elsewhere in the rule. Can you confirm the scope of variables defined in a guard?

I tried a work around by defining the variable in a pre block before the rule, but it didn't work either.

Regards,


Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: guard variables scope [message #899884 is a reply to message #899854] Thu, 02 August 2012 17:19 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 156
Registered: October 2009
Senior Member

On an update on this, if I define the var in the main file pre block (the rule is in a separate file which I import) then it works. Can it be that pre blocks of imported files are bugged?

Regards,


Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: guard variables scope [message #899954 is a reply to message #899884] Fri, 03 August 2012 07:54 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 310
Registered: January 2010
Senior Member
Hi Horacio,

Looking at the code for ErlModule (a superclass of EtlModule), they should work:

	public NamedRules getPre() {
		if (pre == null) {
			pre = new NamedRules();
			for (EolImport import_ : imports) {
				if (import_.isLoaded() && (import_.getModule() instanceof IErlModule)) {
					IErlModule module = (IErlModule) import_.getModule();
					pre.addAll(module.getPre());
				}
			}
			pre.addAll(declaredPre);
		}
		return pre;
	}


Could you set up a minimal example that reproduces the issue?

Cheers,
Antonio
Previous Topic:Epsilon circular import
Next Topic:Editing models using ModeLink
Goto Forum:
  


Current Time: Sat Dec 20 18:04:56 GMT 2014

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

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