Generating duplicate method bodies in AbstractModelInferrer [message #1805329] |
Thu, 11 April 2019 17:18  |
Eclipse User |
|
|
|
I'm having a problem where the AbstractModelInferrer generates an empty method body when reusing an expression that was used to generate a previous method body.
In my grammar I have something like:
Function:
name=ID '{' expression=XExpression '}'
;
In a corresponding AbstractModelInferrer I'd like to generate two corresponding functions for each parsed Function like:
it.members += toMethod(function.name + "_1", someReturnType) [
it.body = function.expression;
]
it.members += toMethod(function.name + "_2", someReturnType) [
it.body = function.expression;
]
I tried to use EcoreUtil2.copy(function.expression) to copy the relevant parts of the AST, but the AbstractModelInferrer always seems to ignore whatever function is generated second (generates an empty method body) after the first method body is generated. I know it seems pointless to generate two identical method implementations, but I'd eventually like to modify key parts of the expression in the second method being generated so they will not be completely identical. Is there a way to do this?
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02777 seconds