aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend2
-rw-r--r--org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java6
2 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend
index 3307fb106..81c406e12 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend
@@ -21,6 +21,7 @@ import org.eclipse.emf.codegen.ecore.generator.Generator
import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter
import org.eclipse.emf.common.util.BasicMonitor
import org.eclipse.emf.ecore.xcore.mappings.XcoreMapper
+import org.eclipse.xtext.common.types.JvmOperation
class XcoreGenerator implements IGenerator {
@@ -36,6 +37,7 @@ class XcoreGenerator implements IGenerator {
for (op : pack.allContentsIterable.filter(typeof(XOperation))) {
val eOperation = op.mapping.EOperation
val appendable = new StringBuilderBasedAppendable()
+ appendable.declareVariable(mappings.getMapping(op).jvmOperation.declaringType,"this");
// val expectedType = op.jvmOperation.returnType
compiler.compile(op.body, appendable, null)
eOperation.EAnnotations.add(createGenModelAnnotation("body", appendable.toString))
diff --git a/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java b/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java
index 952f2abbc..4eb704ab9 100644
--- a/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java
+++ b/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java
@@ -18,6 +18,8 @@ import org.eclipse.emf.ecore.xcore.XOperation;
import org.eclipse.emf.ecore.xcore.XPackage;
import org.eclipse.emf.ecore.xcore.mappings.XOperationMapping;
import org.eclipse.emf.ecore.xcore.mappings.XcoreMapper;
+import org.eclipse.xtext.common.types.JvmDeclaredType;
+import org.eclipse.xtext.common.types.JvmOperation;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.xbase.XBlockExpression;
@@ -49,6 +51,10 @@ public class XcoreGenerator implements IGenerator {
final EOperation eOperation = _eOperation;
StringBuilderBasedAppendable _stringBuilderBasedAppendable = new StringBuilderBasedAppendable();
final StringBuilderBasedAppendable appendable = _stringBuilderBasedAppendable;
+ XOperationMapping _mapping_1 = this.mappings.getMapping(op);
+ JvmOperation _jvmOperation = _mapping_1.getJvmOperation();
+ JvmDeclaredType _declaringType = _jvmOperation.getDeclaringType();
+ appendable.declareVariable(_declaringType, "this");
XBlockExpression _body = op.getBody();
this.compiler.compile(_body, appendable, null);
EList<EAnnotation> _eAnnotations = eOperation.getEAnnotations();