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 11:36 Go to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 151
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 13:19 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 151
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 03:54 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
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: Mon Jul 28 20:39:30 EDT 2014

Powered by FUDForum. Page generated in 0.02775 seconds