local variables: self=IN!<unnamed> [message #1725463] |
Thu, 03 March 2016 16:30 |
Yi Zhu Messages: 9 Registered: March 2016 Location: Boston |
Junior Member |
|
|
Hi
I am working on a project for model transformation. I want to use the attribute of one class that is referenced by another
class. Among them, Datatype is a class that includes an attribute (name) and a refference (datatypep), Pattern is another class that
includes two attributes (pattern, constructor) and a refference (patternd), datatypep is the opposite reference for patternd.
but the compiler always show bug. Please help me. Thanks.
The bug:
org.eclipse.m2m.atl.engine.emfvm.VMException
at __initexpressions#125(Enumerative2Function.atl[64:51-64:84])
local variables: self=IN!<unnamed>
The ATL code:
helper context Enumeratives!Pattern def: DatatypeName : String =
if not self.datatypep.oclIsUndefined()
then
self.datatypep.name
else
''
endif;
helper def: FunctionNameProfix : String = 'eval_';
helper context Enumeratives!Pattern def: patterns : String =
if not self.pattern.oclIsUndefined()
then
if self.pattern = 'int'
then 'n'
else if self.pattern = '(' + thisModule.DatatypeName + ')'
then '(e)'
else if self.pattern = '(' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ')'
then '(e1, e2)'
else if self.pattern = '(' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ')'
then '(e1, e2, e3)'
else ''
endif
endif
endif
endif
else
''
endif;
rule P2C {
from
s : Enumeratives!Pattern
to
t : Functions!Clause (
clause <- s.constructor,
pattern <- s.patterns,
expression <- s.expressions
)
}
Best,
Yi
YI ZHU
|
|
|
Re: local variables: self=IN!<unnamed> [message #1725479 is a reply to message #1725463] |
Thu, 03 March 2016 18:21 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
Maybe someone on the ATL newsgroup can help.
Regards
Ed Willink
On 03/03/2016 17:15, Yi Zhu wrote:
> Hi
>
> I am working on a project for model transformation. I want to use the
> attribute of one class that is referenced by another
> class. Among them, Datatype is a class that includes an attribute
> (name) and a refference (datatypep), Pattern is another class that
> includes two attributes (pattern, constructor) and a refference
> (patternd), datatypep is the opposite reference for patternd.
> but the compiler always show bug. Please help me. Thanks.
>
> The bug:
>
> org.eclipse.m2m.atl.engine.emfvm.VMException
> at __initexpressions#125(Enumerative2Function.atl[64:51-64:84])
> local variables: self=IN!<unnamed>
>
> The ATL code:
>
> helper context Enumeratives!Pattern def: DatatypeName : String =
> if not self.datatypep.oclIsUndefined()
> then self.datatypep.name
> else
> ''
> endif;
> helper def: FunctionNameProfix : String = 'eval_';
>
> helper context Enumeratives!Pattern def: patterns : String =
> if not self.pattern.oclIsUndefined()
> then
> if self.pattern = 'int'
> then 'n'
> else if self.pattern = '(' + thisModule.DatatypeName + ')'
> then '(e)'
> else if self.pattern = '(' + thisModule.DatatypeName + ',
> ' + thisModule.DatatypeName + ')'
> then '(e1, e2)'
> else if self.pattern = '(' + thisModule.DatatypeName
> + ', ' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ')'
> then '(e1, e2, e3)'
> else ''
> endif
> endif
> endif
> endif
> else
> ''
> endif;
>
>
> rule P2C {
> from s : Enumeratives!Pattern
> to t : Functions!Clause (
> clause <- s.constructor,
> pattern <- s.patterns,
> expression <- s.expressions
> )
> }
>
> Best,
>
> Yi
|
|
|
|
Powered by
FUDForum. Page generated in 0.03676 seconds