summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahaase2008-02-02 11:17:57 (EST)
committerahaase2008-02-02 11:17:57 (EST)
commitf22ee6d98adcbf897c8ae2bd3678fb9ebb05428a (patch)
tree770196202d045a8e842ff64e8838e4184b3e4928
parent44ed6ba4f5a20767a5845d3dd1c244331554bf59 (diff)
downloadorg.eclipse.xpand-f22ee6d98adcbf897c8ae2bd3678fb9ebb05428a.zip
org.eclipse.xpand-f22ee6d98adcbf897c8ae2bd3678fb9ebb05428a.tar.gz
org.eclipse.xpand-f22ee6d98adcbf897c8ae2bd3678fb9ebb05428a.tar.bz2
refactored
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/BackendFacade.java5
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionContext.java11
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionException.java19
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExpressionBase.java4
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/SourcePos.java2
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/StacktraceEntry.java43
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/HidingLocalVarDefExpression.java5
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/NewLocalVarDefExpression.java10
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/functions/SourceDefinedFunction.java8
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/CreationCacheImpl.java (renamed from plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/CreationCacheImpl.java)4
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/ExecutionContextImpl.java (renamed from plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/ExecutionContextImpl.java)27
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/FunctionInvokerImpl.java (renamed from plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/FunctionInvokerImpl.java)4
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/GlobalParamContextImpl.java (renamed from plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/GlobalParamContextImpl.java)4
-rw-r--r--plugins/org.eclipse.xtend.backend/todo.txt23
-rw-r--r--plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XpandBackendFacade.java2
-rw-r--r--plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XtendBackendFacade.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java318
-rw-r--r--tests/org.eclipse.xtend.middleend.old.test/src/org/eclipse/xtend/middleend/old/first/FirstAttempt.java6
18 files changed, 210 insertions, 289 deletions
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/BackendFacade.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/BackendFacade.java
index 034c697..22ec951 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/BackendFacade.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/BackendFacade.java
@@ -15,6 +15,7 @@ import java.util.List;
import org.eclipse.xtend.backend.common.BackendTypesystem;
import org.eclipse.xtend.backend.common.ExecutionContext;
import org.eclipse.xtend.backend.common.FunctionDefContext;
+import org.eclipse.xtend.backend.internal.ExecutionContextImpl;
/**
@@ -22,8 +23,8 @@ import org.eclipse.xtend.backend.common.FunctionDefContext;
* @author Arno Haase (http://www.haase-consulting.com)
*/
public class BackendFacade {
- public static ExecutionContext createExecutionContext (FunctionDefContext initialContext, BackendTypesystem typesystem) {
- return new ExecutionContextImpl (initialContext, typesystem);
+ public static ExecutionContext createExecutionContext (FunctionDefContext initialContext, BackendTypesystem typesystem, boolean logStacktrace) {
+ return new ExecutionContextImpl (initialContext, typesystem, logStacktrace);
}
public static Object invoke (ExecutionContext ctx, String functionName, List<? extends Object> params) {
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionContext.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionContext.java
index 0bf1274..802a71f 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionContext.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionContext.java
@@ -10,6 +10,8 @@ Contributors:
*/
package org.eclipse.xtend.backend.common;
+import java.util.List;
+
/**
*
@@ -30,5 +32,14 @@ public interface ExecutionContext {
void logNullDeRef (SourcePos pos);
+ boolean isLogStacktrace ();
+ /**
+ * Maintaining the stack trace requires expensive operations during regular
+ * operation - it can not be done retrospectively. Therefore the stacktrace
+ * is maintained only if the isLogStacktrace flag is set, otherwise this
+ * method returns an empty list.
+ */
+ List<StacktraceEntry> getStacktrace ();
+
ContributionStateContext getContributionStateContext ();
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionException.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionException.java
index 2a07738..d60829a 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionException.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExecutionException.java
@@ -12,9 +12,6 @@ package org.eclipse.xtend.backend.common;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-
-import org.eclipse.xtend.backend.util.Pair;
/**
@@ -22,21 +19,19 @@ import org.eclipse.xtend.backend.util.Pair;
* @author Arno Haase (http://www.haase-consulting.com)
*/
public class ExecutionException extends RuntimeException {
- private final List<Pair<SourcePos, Map<String, Object>>> _stackTrace = new ArrayList<Pair<SourcePos,Map<String,Object>>> ();
-
+ private final List<StacktraceEntry> _stackTrace = new ArrayList<StacktraceEntry> ();
public ExecutionException (Exception exc) {
super (exc);
}
-
- public ExecutionException (Exception exc, SourcePos sourcePos, Map<String, Object> localVars) {
+ public ExecutionException (Exception exc, StacktraceEntry ste) {
super (exc);
- addStackTraceElement (sourcePos, localVars);
+ addStackTraceElement (ste);
}
- public void addStackTraceElement (SourcePos sourcePos, Map<String, Object> localVars) {
- _stackTrace.add (new Pair<SourcePos, Map<String, Object>> (sourcePos, localVars));
+ public void addStackTraceElement (StacktraceEntry ste) {
+ _stackTrace.add (ste);
}
@Override
@@ -44,8 +39,8 @@ public class ExecutionException extends RuntimeException {
final StringBuilder result = new StringBuilder ();
result.append (getCause().getMessage() + "\n");
- for (Pair<SourcePos, Map<String, Object>> ste: _stackTrace)
- result.append ("at " + ste.getFirst() + " " + ste.getSecond() + "\n");
+ for (StacktraceEntry ste: _stackTrace)
+ result.append (ste + "\n");
return result.toString();
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExpressionBase.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExpressionBase.java
index 779cd2c..2ebf880 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExpressionBase.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/ExpressionBase.java
@@ -52,11 +52,11 @@ public abstract class ExpressionBase {
return result;
}
catch (ExecutionException exc) {
- exc.addStackTraceElement (_sourcePos, ctx.getLocalVarContext().getLocalVars());
+ exc.addStackTraceElement (new StacktraceEntry (_sourcePos, ctx));
throw exc;
}
catch (Exception exc) {
- throw new ExecutionException (exc, _sourcePos, ctx.getLocalVarContext().getLocalVars());
+ throw new ExecutionException (exc, new StacktraceEntry (_sourcePos, ctx));
}
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/SourcePos.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/SourcePos.java
index f34c457..50cfc0f 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/SourcePos.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/SourcePos.java
@@ -39,7 +39,7 @@ public class SourcePos {
@Override
public String toString () {
- return "line " + _lineNumber + "@" + _callableName + " [" + _compilationUnit + "]";
+ return _callableName + "@" + _lineNumber + " [" + _compilationUnit + "]";
}
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/StacktraceEntry.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/StacktraceEntry.java
new file mode 100644
index 0000000..2b527d4
--- /dev/null
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/common/StacktraceEntry.java
@@ -0,0 +1,43 @@
+/*
+Copyright (c) 2008 Arno Haase.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Arno Haase - initial API and implementation
+ */
+package org.eclipse.xtend.backend.common;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * This class represents an entry in the stack trace of the backend execution.
+ *
+ * @author Arno Haase (http://www.haase-consulting.com)
+ */
+public final class StacktraceEntry {
+ private final SourcePos _sourcePos;
+ private final Map<String, Object> _localVars;
+
+ public StacktraceEntry (SourcePos sourcePos, ExecutionContext ctx) {
+ _sourcePos = sourcePos;
+ _localVars = new HashMap<String, Object> (ctx.getLocalVarContext().getLocalVars());
+ }
+
+ public SourcePos getSourcePos () {
+ return _sourcePos;
+ }
+
+ public Map<String, Object> getLocalVars () {
+ return _localVars;
+ }
+
+ @Override
+ public String toString () {
+ return "at " + getSourcePos() + " " + getLocalVars();
+ }
+}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/HidingLocalVarDefExpression.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/HidingLocalVarDefExpression.java
index 0f81237..964bf7c 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/HidingLocalVarDefExpression.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/HidingLocalVarDefExpression.java
@@ -13,6 +13,7 @@ package org.eclipse.xtend.backend.expr;
import org.eclipse.xtend.backend.common.ExecutionContext;
import org.eclipse.xtend.backend.common.ExpressionBase;
import org.eclipse.xtend.backend.common.SourcePos;
+import org.eclipse.xtend.backend.common.StacktraceEntry;
/**
@@ -36,10 +37,14 @@ public final class HidingLocalVarDefExpression extends ExpressionBase {
final Object oldValue = ctx.getLocalVarContext().getLocalVars().get(_localVarName);
ctx.getLocalVarContext().getLocalVars().put (_localVarName, _defExpression.evaluate(ctx));
+ if (ctx.isLogStacktrace())
+ ctx.getStacktrace().add (new StacktraceEntry (getPos(), ctx));
+
try {
return _inner.evaluate(ctx);
}
finally {
+ ctx.getStacktrace ().remove (ctx.getStacktrace().size() - 1);
ctx.getLocalVarContext().getLocalVars().put(_localVarName, oldValue);
}
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/NewLocalVarDefExpression.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/NewLocalVarDefExpression.java
index befc4c3..d205c1b 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/NewLocalVarDefExpression.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/expr/NewLocalVarDefExpression.java
@@ -13,6 +13,7 @@ package org.eclipse.xtend.backend.expr;
import org.eclipse.xtend.backend.common.ExecutionContext;
import org.eclipse.xtend.backend.common.ExpressionBase;
import org.eclipse.xtend.backend.common.SourcePos;
+import org.eclipse.xtend.backend.common.StacktraceEntry;
/**
@@ -24,8 +25,7 @@ public final class NewLocalVarDefExpression extends ExpressionBase {
private final ExpressionBase _defExpression;
private final ExpressionBase _inner;
- public NewLocalVarDefExpression (String localVarName, ExpressionBase defExpression, ExpressionBase inner,
- SourcePos sourcePos) {
+ public NewLocalVarDefExpression (String localVarName, ExpressionBase defExpression, ExpressionBase inner, SourcePos sourcePos) {
super (sourcePos);
_localVarName = localVarName;
_defExpression = defExpression;
@@ -36,11 +36,15 @@ public final class NewLocalVarDefExpression extends ExpressionBase {
protected Object evaluateInternal(ExecutionContext ctx) {
ctx.getLocalVarContext().getLocalVars().put (_localVarName, _defExpression.evaluate(ctx));
+ if (ctx.isLogStacktrace())
+ ctx.getStacktrace().add (new StacktraceEntry (getPos(), ctx));
+
try {
return _inner.evaluate(ctx);
}
finally {
- ctx.getLocalVarContext().getLocalVars().remove(_localVarName);
+ ctx.getStacktrace ().remove (ctx.getStacktrace().size() - 1);
+ ctx.getLocalVarContext ().getLocalVars ().remove (_localVarName);
}
}
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/functions/SourceDefinedFunction.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/functions/SourceDefinedFunction.java
index e17a07d..ace0b56 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/functions/SourceDefinedFunction.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/functions/SourceDefinedFunction.java
@@ -18,6 +18,7 @@ import org.eclipse.xtend.backend.common.ExpressionBase;
import org.eclipse.xtend.backend.common.Function;
import org.eclipse.xtend.backend.common.FunctionDefContext;
import org.eclipse.xtend.backend.common.LocalVarContext;
+import org.eclipse.xtend.backend.common.StacktraceEntry;
/**
@@ -79,9 +80,16 @@ public final class SourceDefinedFunction implements Function {
final LocalVarContext oldLvc = ctx.getLocalVarContext();
try {
ctx.setLocalVarContext(lvc);
+
+ if (ctx.isLogStacktrace())
+ ctx.getStacktrace().add (new StacktraceEntry (_def.getPos(), ctx));
+
return _def.evaluate(ctx);
}
finally {
+ if (ctx.isLogStacktrace())
+ ctx.getStacktrace().remove (ctx.getStacktrace().size() - 1);
+
ctx.setLocalVarContext(oldLvc);
}
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/CreationCacheImpl.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/CreationCacheImpl.java
index 982d08d..cd030b0 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/CreationCacheImpl.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/CreationCacheImpl.java
@@ -8,7 +8,7 @@ http://www.eclipse.org/legal/epl-v10.html
Contributors:
Arno Haase - initial API and implementation
*/
-package org.eclipse.xtend.backend;
+package org.eclipse.xtend.backend.internal;
import java.util.List;
@@ -21,7 +21,7 @@ import org.eclipse.xtend.backend.util.DoubleKeyCache;
*
* @author Arno Haase (http://www.haase-consulting.com)
*/
-final class CreationCacheImpl implements CreationCache {
+public final class CreationCacheImpl implements CreationCache {
private DoubleKeyCache<BackendType, List<Object>, Object> _cache = new DoubleKeyCache<BackendType, List<Object>, Object> () {
@Override
protected Object create(BackendType t, List<Object> key2) {
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/ExecutionContextImpl.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/ExecutionContextImpl.java
index 0226e93..c850792 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/ExecutionContextImpl.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/ExecutionContextImpl.java
@@ -8,7 +8,10 @@ http://www.eclipse.org/legal/epl-v10.html
Contributors:
Arno Haase - initial API and implementation
*/
-package org.eclipse.xtend.backend;
+package org.eclipse.xtend.backend.internal;
+
+import java.util.ArrayList;
+import java.util.List;
import org.apache.commons.logging.LogFactory;
import org.eclipse.xtend.backend.common.BackendTypesystem;
@@ -21,25 +24,29 @@ import org.eclipse.xtend.backend.common.FunctionInvoker;
import org.eclipse.xtend.backend.common.GlobalParamContext;
import org.eclipse.xtend.backend.common.LocalVarContext;
import org.eclipse.xtend.backend.common.SourcePos;
+import org.eclipse.xtend.backend.common.StacktraceEntry;
/**
*
* @author Arno Haase (http://www.haase-consulting.com)
*/
-final class ExecutionContextImpl implements ExecutionContext {
+public final class ExecutionContextImpl implements ExecutionContext {
private final CreationCache _creationCache = new CreationCacheImpl ();
private FunctionDefContext _functionDefContext;
private LocalVarContext _localVarContext = new LocalVarContext ();
private final FunctionInvoker _functionInvoker = new FunctionInvokerImpl ();
private final BackendTypesystem _typeSystem;
private final GlobalParamContext _globalParamContext = new GlobalParamContextImpl ();
+ private final boolean _logStacktrace;
+ private final List<StacktraceEntry> _stacktrace = new ArrayList<StacktraceEntry> ();
private final ContributionStateContext _contributionStateContext = new ContributionStateContext ();
- public ExecutionContextImpl (FunctionDefContext initialFunctionDefContext, BackendTypesystem typesystem) {
+ public ExecutionContextImpl (FunctionDefContext initialFunctionDefContext, BackendTypesystem typesystem, boolean logStacktrace) {
_functionDefContext = initialFunctionDefContext;
_typeSystem = typesystem;
+ _logStacktrace = logStacktrace;
}
public CreationCache getCreationCache() {
@@ -75,10 +82,22 @@ final class ExecutionContextImpl implements ExecutionContext {
}
public void logNullDeRef (SourcePos pos) {
- LogFactory.getLog (Constants.LOG_NULL_DEREF).warn ("dereferenced null (" + pos + ")");
+ final StringBuilder sb = new StringBuilder ("dereferenced null (" + pos + ")");
+ for (int i=_stacktrace.size() - 1; i>= 0; i--)
+ sb.append ("\n " + _stacktrace.get (i));
+
+ LogFactory.getLog (Constants.LOG_NULL_DEREF).warn (sb);
}
public ContributionStateContext getContributionStateContext () {
return _contributionStateContext;
}
+
+ public List<StacktraceEntry> getStacktrace () {
+ return _stacktrace;
+ }
+
+ public boolean isLogStacktrace () {
+ return _logStacktrace;
+ }
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/FunctionInvokerImpl.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/FunctionInvokerImpl.java
index f1603c1..4b9b554 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/FunctionInvokerImpl.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/FunctionInvokerImpl.java
@@ -8,7 +8,7 @@ http://www.eclipse.org/legal/epl-v10.html
Contributors:
Arno Haase - initial API and implementation
*/
-package org.eclipse.xtend.backend;
+package org.eclipse.xtend.backend.internal;
import java.util.List;
@@ -23,7 +23,7 @@ import org.eclipse.xtend.backend.util.DoubleKeyCache;
*
* @author Arno Haase (http://www.haase-consulting.com)
*/
-final class FunctionInvokerImpl implements FunctionInvoker {
+public final class FunctionInvokerImpl implements FunctionInvoker {
private final DoubleKeyCache <Function, List<?>, Object> _cache = new DoubleKeyCache<Function, List<?>, Object> () {
@Override
protected Object create (Function f, List<?> params) {
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/GlobalParamContextImpl.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/GlobalParamContextImpl.java
index 9b4ddfd..53b596e 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/GlobalParamContextImpl.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/internal/GlobalParamContextImpl.java
@@ -8,7 +8,7 @@ http://www.eclipse.org/legal/epl-v10.html
Contributors:
Arno Haase - initial API and implementation
*/
-package org.eclipse.xtend.backend;
+package org.eclipse.xtend.backend.internal;
import java.util.HashMap;
import java.util.Map;
@@ -20,7 +20,7 @@ import org.eclipse.xtend.backend.common.GlobalParamContext;
*
* @author Arno Haase (http://www.haase-consulting.com)
*/
-final class GlobalParamContextImpl implements GlobalParamContext {
+public final class GlobalParamContextImpl implements GlobalParamContext {
private final Map<String, Object> _globalVars = new HashMap<String, Object> ();
public Map<String, Object> getGlobalParams() {
diff --git a/plugins/org.eclipse.xtend.backend/todo.txt b/plugins/org.eclipse.xtend.backend/todo.txt
index 1941842..61b58e7 100644
--- a/plugins/org.eclipse.xtend.backend/todo.txt
+++ b/plugins/org.eclipse.xtend.backend/todo.txt
@@ -1,41 +1,32 @@
todo
----
registry of handlers for different kinds of resources (including classes and byte code (?)); classes need way to express their fdc!!! --> rethink fdc concept?
+ --> via extension point (with a static "priority" getter to allow ordering)? Compiled first?
make the concept of the "XyzRegistry" explicit, common abstraction --> interoperability of languages
-configuration of backend type system - parameters to the backend?
globalVars rauswerfen? --> ContributionStateContext?
JavaBeansType: Interfaces als Supertypen
UML type system
-logNullDeRef: log call stack including call parameters - runtime flag to log "verbosely"?
AOP
Profiler
+Protected Region Resolver
-Check: SourcePos-Infos in Fehlern, Exceptions in ExpressionBase ordentlich gewrappt
+List.sortBy(closure)
+new String --> ""
static properties; enums
kommentieren
-Marker-Interface / Annotation "FunctionDefs" o.ä. --> generische Unterscheidung für Java-Importer, ob Klasse
- als Bean oder als "Funktionen-Container"
-
-testen, insbes. syslib
-
-DefinitionType in FunctionType mergen
-
dead code elimination?
isInstance
-Buddy Policy für syslib und backend
-
syslib-Funktion: allFunctions (List<Type>) --> auch Funktionen ohne Parameter zur Laufzeit
finden (oder built-in? --> syslib-Aufruf verlässt den Scope)
Function-Match (z.B. &myFunc (String, Foo) --> spät binden! --> dynamisch durchgereichter Kram
wird gematcht
Currying
-Map als Builtin-Typ
Properties über getter/setter abbilden (z.B. im mm keine property mehr)?
Eigene Properties definieren (d.h. generische Map dafür an jedem Objekt)?
"final" (auch als Hint für Optimierung --> wird nicht durch dynamische Exytensions
@@ -59,6 +50,9 @@ replace/add von Extensions im dynamischen Scope
equals auf Type-Implementierungen
+move to m2t.common
+
+JET support: JET templates are treated just like any other Java Bean
Unterstützung
-------------
@@ -104,4 +98,5 @@ toString() überschreibbar, trotz lazy evaluation
Operators: implies, <, <=, ==, !=, >=, >, !, unary -,
potential bug - EfficientLazyString is mutable || return value from cached function -->
flag "isImmutable" in EfficientLazyString; static method "concat" insetad of "append" to treat this transparently
-
+logNullDeRef: log call stack including call parameters - runtime flag to log "verbosely"?
+Map als Builtin-Typ
diff --git a/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XpandBackendFacade.java b/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XpandBackendFacade.java
index 61ba1df..def5cce 100644
--- a/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XpandBackendFacade.java
+++ b/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XpandBackendFacade.java
@@ -124,7 +124,7 @@ public final class XpandBackendFacade {
fdc.register (f);
}
- final ExecutionContext backendCtx = BackendFacade.createExecutionContext (fdc, ts);
+ final ExecutionContext backendCtx = BackendFacade.createExecutionContext (fdc, ts, true); //TODO configure isLogStacktrace
backendCtx.getLocalVarContext().getLocalVars().putAll (variables);
registerOutlets (backendCtx, outlets);
diff --git a/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XtendBackendFacade.java b/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XtendBackendFacade.java
index 94abeef..a14e513 100644
--- a/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XtendBackendFacade.java
+++ b/plugins/org.eclipse.xtend.middleend.old/src/org/eclipse/xtend/middleend/old/XtendBackendFacade.java
@@ -77,7 +77,7 @@ public final class XtendBackendFacade {
final ExpressionBase newAst = new OldExpressionConverter (ctx, typeConverter, "<no file>").convert(oldAst);
final FunctionDefContext fdc = (initialXtendFileName != null) ? createForFile (initialXtendFileName, fileEncoding, mms).getFunctionDefContext() : new FunctionDefContextFactory (ts).create();
- final ExecutionContext newCtx = BackendFacade.createExecutionContext (fdc, ts);
+ final ExecutionContext newCtx = BackendFacade.createExecutionContext (fdc, ts, true); //TODO configure isLogStacktrace
newCtx.getLocalVarContext().getLocalVars().putAll (localVars);
return newAst.evaluate (newCtx);
@@ -90,7 +90,7 @@ public final class XtendBackendFacade {
public static Object invokeXtendFunction (String xtendFileName, String fileEncoding, Collection<MetaModel> mms, String functionName, Object... parameters) {
final XtendBackendFacade xbf = createForFile (xtendFileName, fileEncoding, mms);
final FunctionDefContext fdc = xbf.getFunctionDefContext();
- final ExecutionContext ctx = BackendFacade.createExecutionContext (fdc, OldXtendHelper.guessTypesystem (mms));
+ final ExecutionContext ctx = BackendFacade.createExecutionContext (fdc, OldXtendHelper.guessTypesystem (mms), true); //TODO configure isLogStacktrace
return fdc.invoke (ctx, functionName, Arrays.asList (parameters));
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
index 5e4ed36..43cce5a 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
@@ -12,6 +12,7 @@
package org.eclipse.xtend.expression.ast;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -43,195 +44,107 @@ public class EvaluationTest extends TestCase {
ec.registerMetaModel(new JavaMetaModel("asdf", new JavaBeansStrategy()));
}
- private Expression parse (final String expression) {
- return ParseFacade.expression(expression);
- }
-
- private Object eval (Expression expr) {
+ private Object eval (String expression) {
+ final Expression expr = ParseFacade.expression(expression);
return expr.evaluate (ec);
}
+ private Object eval (String expression, String localVarName, Object localVarValue) {
+ ec = (ExecutionContextImpl) ec.cloneWithVariable (new Variable (localVarName, localVarValue));
+ return eval (expression);
+ }
+
public final void testSimple() {
- final Expression expr = parse("true == null");
- final Object result = eval (expr);
+ final Object result = eval ("true == null");
assertFalse(((Boolean) result).booleanValue());
}
public final void testStaticPropertyCall() {
- final Expression expr = parse("org::eclipse::xtend::expression::Type1::TYPE1_OBJECT_OBJECT");
- final Object result = eval (expr);
+ final Object result = eval ("org::eclipse::xtend::expression::Type1::TYPE1_OBJECT_OBJECT");
assertEquals(Type1.TYPE1_OBJECT_OBJECT, result);
}
- public final void testCollectionLiteral1() {
- final Expression expr = parse("{\"hallo\"}");
- final Object result = eval (expr);
- assertEquals("hallo", ((List) result).iterator().next());
- }
-
- public final void testCollectionLiteral3() {
- final Expression expr = parse("{3}");
- final Object result = eval (expr);
- assertEquals(new Long(3), ((List) result).iterator().next());
- }
-
- public final void testCollectionLiteral2() {
- final Expression expr = parse("{\"hallo\",3}");
- final List result = (List) eval (expr);
- assertEquals(2, result.size());
- assertEquals("hallo", result.get(0));
- assertEquals(new Long(3), result.get(1));
+ @SuppressWarnings("unchecked")
+ public final void testCollectionLiteral1() {
+ assertEquals(Arrays.asList("hallo"), eval ("{\"hallo\"}"));
+ assertEquals(Arrays.asList(3L), eval ("{3}"));
+ assertEquals (Arrays.asList("hallo", 3L), eval ("{\"hallo\",3}"));
}
public final void testFeatureCall() {
- final Expression expr = parse("test");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new AType()));
- final Object result = eval (expr);
+ final Object result = eval ("test", ExecutionContext.IMPLICIT_VARIABLE, new AType ());
assertEquals(new AType().getTest(), result);
}
public final void testFeatureCall1() {
- final Expression expr = parse("this.test");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new AType()));
- final Object result = eval (expr);
+ final Object result = eval ("this.test", ExecutionContext.IMPLICIT_VARIABLE, new AType ());
assertEquals(new AType().getTest(), result);
-
}
public final void testOperationCall1() {
- final Expression expr = parse("myOperation()");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new AType()));
- final Object result = eval (expr);
-
+ final Object result = eval ("myOperation()", ExecutionContext.IMPLICIT_VARIABLE, new AType ());
assertEquals(new AType().myOperation(), result);
-
}
public final void testOperationCall2() {
- final Expression expr = parse("myOperation(\"Test\")");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new AType()));
- final Object result = eval (expr);
-
+ final Object result = eval ("myOperation(\"Test\")", ExecutionContext.IMPLICIT_VARIABLE, new AType ());
assertEquals(new AType().myOperation("Test"), result);
}
public final void testOperationCall3() {
- final Expression expr = parse("this.myOperation()");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new AType()));
- final Object result = eval (expr);
-
+ final Object result = eval ("this.myOperation()", ExecutionContext.IMPLICIT_VARIABLE, new AType ());
assertEquals(new AType().myOperation(), result);
-
}
public final void testOperationCall4() {
- final Expression expr = parse("this.myOperation(\"Test\")");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new AType()));
- final Object result = eval (expr);
-
+ final Object result = eval ("this.myOperation(\"Test\")", ExecutionContext.IMPLICIT_VARIABLE, new AType ());
assertEquals(new AType().myOperation("Test"), result);
-
}
public final void testArithmetic() {
- Expression expr;
-
- expr = parse("4 * 2 + 3");
- assertEquals(new Long(11), eval (expr));
-
- expr = parse("3 + 4 * 2");
- assertEquals(new Long(11), eval (expr));
-
- expr = parse("4 * 2 + 3 / 3");
- assertEquals(new Long(9), eval (expr));
- }
-
- public final void testArithmetic2() {
- Expression expr = parse("3 + 4.0 * 2");
- assertEquals(new Double(11), eval (expr));
-
- expr = parse("4.0 * 2 + 3");
- assertEquals(new Double(11), eval (expr));
+ assertEquals(new Long(11), eval ("4 * 2 + 3"));
+ assertEquals(new Long(11), eval ("3 + 4 * 2"));
+ assertEquals(new Long(9), eval ("4 * 2 + 3 / 3"));
- expr = parse("4 * 2 + 3 / 3.0");
- assertEquals(new Double(9), eval (expr));
-
- }
-
- public final void testArithmetic3() {
- Expression expr = parse("5 / 2");
- assertEquals(new Long(2), eval (expr));
-
- expr = parse("5 / 2.0");
- assertEquals(new Double(2.5), eval (expr));
+ assertEquals(new Double(11), eval ("3 + 4.0 * 2"));
+ assertEquals(new Double(11), eval ("4.0 * 2 + 3"));
+ assertEquals(new Double(9), eval ("4 * 2 + 3 / 3.0"));
+ assertEquals(new Long(2), eval ("5 / 2"));
+ assertEquals(new Double(2.5), eval ("5 / 2.0"));
}
public final void testStringConcatenation() {
- final Expression expr = parse("\"test\" + 3 + 4");
- assertEquals("test34", eval (expr));
+ assertEquals("test34", eval ("\"test\" + 3 + 4"));
}
public final void testNullReference() {
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- "nullRef", null));
- final Expression expr = parse("nullRef + \"test\" + 3 + 4");
- assertEquals(null, eval (expr));
-
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable("this",
- null));
- assertNull(eval (parse("this.unknownMember")));
+ assertEquals(null, eval ("nullRef + \"test\" + 3 + 4", "nullRef", null));
+ assertNull(eval ("this.unknownMember", "this", null));
}
public final void testTypeLiteral1() {
- assertEquals(ec.getStringType(), eval (parse("String")));
- }
+ assertEquals(ec.getStringType(), eval ("String"));
- public final void testTypeLiteral2() {
- final Expression e = parse("String.getProperty('length')");
- assertTrue (eval (e) instanceof Property);
- }
+ assertTrue (eval ("String.getProperty('length')") instanceof Property);
- public final void testTypeLiteral3() {
- final Expression e = parse(getATypeName() + "::TEST");
- assertEquals(AType.TEST, eval(e));
+ assertEquals(AType.TEST, eval(getATypeName() + "::TEST"));
}
private String getATypeName() {
- return AType.class.getName()
- .replaceAll("\\.", SyntaxConstants.NS_DELIM);
+ return AType.class.getName().replaceAll("\\.", SyntaxConstants.NS_DELIM);
}
public final void testPath1() {
- final Expression expr = parse("{'a','b','c'}.toUpperCase()");
- final List result = (List) eval (expr);
- assertEquals("A", result.get(0));
- assertEquals("B", result.get(1));
- assertEquals("C", result.get(2));
- }
+ assertEquals (Arrays.asList("A", "B", "C"), eval ("{'a','b','c'}.toUpperCase()"));
- public final void testPath2() {
- final Expression expr = parse("{'a','b','c'}.size");
- assertEquals(new Long(3), eval (expr));
- }
+ assertEquals(new Long(3), eval ("{'a','b','c'}.size"));
- public final void testPath3() {
- final Expression expr = parse("{'a','b2','c'}.toUpperCase().length");
- final List result = (List) eval (expr);
- assertEquals(new Long(1), result.get(0));
- assertEquals(new Long(2), result.get(1));
- assertEquals(new Long(1), result.get(2));
+ assertEquals (Arrays.asList (1L, 2L, 1L), eval ("{'a','b2','c'}.toUpperCase().length"));
}
public final void testPath4() {
- final Expression expr = parse("{'a,b2,c','a,b,c','a,b,c'}.split(',').length");
- final List result = (List) eval (expr);
+ final List<?> result = (List<?>) eval ("{'a,b2,c','a,b,c','a,b,c'}.split(',').length");
assertEquals(9, result.size());
assertEquals(new Long(1), result.get(0));
assertEquals(new Long(2), result.get(1));
@@ -239,81 +152,51 @@ public class EvaluationTest extends TestCase {
}
public final void testNestedCollExpr() {
- final Expression expr = parse("col.typeSelect(String).forAll(e|"
- + "col.typeSelect(Integer).exists(a| a == e.length))");
- final List<Comparable> list = new ArrayList<Comparable>();
+ final List<Object> list = new ArrayList<Object>();
list.add("123");
list.add("1234");
list.add("12345");
list.add(new Long(3));
list.add(new Long(4));
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable("col",
- list));
- assertEquals(Boolean.FALSE, eval (expr));
+
+ final String expr = "col.typeSelect(String).forAll(e|col.typeSelect(Integer).exists(a| a == e.length))";
+ assertEquals(Boolean.FALSE, eval (expr, "col", list));
+
list.add(new Long(5));
- assertEquals(Boolean.TRUE, eval (expr));
+ assertEquals(Boolean.TRUE, eval (expr, "col", list));
}
public final void testTypeSelectWithNull() {
- final Expression expr = parse("{null, 'test'}.typeSelect(String).size");
- assertEquals(new Long(1), eval (expr));
+ assertEquals(new Long(1), eval ("{null, 'test'}.typeSelect(String).size"));
}
public final void testGlobalVar() {
- ec = new ExecutionContextImpl(Collections.singletonMap("horst",
- new Variable("horst", "TEST")));
- final Expression expr = parse("GLOBALVAR horst");
- assertEquals("TEST", eval (expr));
+ ec = new ExecutionContextImpl(Collections.singletonMap("horst", new Variable("horst", "TEST")));
+ assertEquals("TEST", eval ("GLOBALVAR horst"));
}
- public final void testLet1() {
- final Expression expr = parse("let x = {'a,b2,c','a,b,c','1,2,3'} : x.get(1)");
- assertEquals("a,b,c", eval (expr));
+ public final void testLet() {
+ assertEquals("a,b,c", eval ("let x = {'a,b2,c','a,b,c','1,2,3'} : x.get(1)"));
+ assertEquals(Arrays.asList("1", "2", "3"), eval ("let x = {} : x.add('1') -> x.add('2') -> x.add('3') -> x"));
}
public final void testCollectShortcut1() {
- final Expression expr = parse("{'a','b','c'}.toUpperCase()");
- assertEquals("C", ((List) eval (expr)).get(2));
- }
+ assertEquals(Arrays.asList("A", "B", "C"), eval ("{'a','b','c'}.toUpperCase()"));
+ assertEquals(Arrays.asList(1L, 1L, 1L), eval ("{'a','b','c'}.length"));
- public final void testCollectShortcut2() {
- final Expression expr = parse("{}.toUpperCase()");
- assertTrue(((List) eval (expr)).isEmpty());
- }
-
- public final void testCollectShortcut3() {
- final Expression expr = parse("{'a','b','c'}.length");
- assertEquals(1l, ((List) eval (expr)).get(2));
- }
-
- public final void testCollectShortcut4() {
- final Expression expr = parse("{}.length");
- assertTrue(((List) eval (expr)).isEmpty());
+ assertEquals(Collections.emptyList(), eval ("{}.toUpperCase()"));
+ assertEquals (Collections.emptyList(), eval ("{}.length"));
}
public final void testCollectShortcut5() {
- final Expression expr = parse("String.name");
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable(
- ExecutionContext.IMPLICIT_VARIABLE, new ArrayList<Object>()));
- assertEquals("String", eval (expr));
- }
-
- public final void testLet2() {
- final Expression expr = parse("let x = {} : x.add('1') -> x.add('2')"
- + " -> x.add('3') -> x");
- final List<String> l = new ArrayList<String>();
- l.add("1");
- l.add("2");
- l.add("3");
- assertEquals(l, eval (expr));
+ assertEquals ("String", eval ("String.name", ExecutionContext.IMPLICIT_VARIABLE, new ArrayList<Object>()));
}
public final void testConstruction() {
- final Expression expr = parse("new String");
- assertEquals("", eval (expr));
+ assertEquals("", eval ("new String"));
try {
- eval (parse("new Unkown"));
+ eval ("new Unkown");
fail();
} catch (final EvaluationException ee) {
// expected
@@ -321,84 +204,41 @@ public class EvaluationTest extends TestCase {
}
public void testSortBy() throws Exception {
- final Expression expr = parse("{'X','AA','BBB'}.sortBy(e|e)");
- final List<String> l = new ArrayList<String>();
- l.add("AA");
- l.add("BBB");
- l.add("X");
- assertEquals(l, eval (expr));
- }
-
- public void testSortBy2() throws Exception {
- final Expression expr = parse("{'X','AA','BBB'}.sortBy(e|e.length)");
- final List<String> l = new ArrayList<String>();
- l.add("X");
- l.add("AA");
- l.add("BBB");
- assertEquals(l, eval (expr));
+ assertEquals(Arrays.asList("AA", "BBB", "X"), eval ("{'X','AA','BBB'}.sortBy(e|e)"));
+ assertEquals(Arrays.asList("X", "AA", "BBB"), eval ("{'X','AA','BBB'}.sortBy(e|e.length)"));
}
public void testIfExpression() throws Exception {
- assertEquals(true, eval (parse("if true then true else 'stuff'")));
- assertEquals("stuff", eval (parse("if false then false else 'stuff'")));
- assertEquals("stuff", eval (parse("if false then false else if true then 'stuff' else null ")));
- assertEquals(null, eval (parse("if false then false else if false then 'stuff' ")));
+ assertEquals(true, eval ("if true then true else 'stuff'"));
+ assertEquals("stuff", eval ("if false then false else 'stuff'"));
+ assertEquals("stuff", eval ("if false then false else if true then 'stuff' else null "));
+ assertEquals(null, eval ("if false then false else if false then 'stuff' "));
}
-
public void testCollectShortCutWithFeatureCalls() throws Exception {
- Expression e = parse("x.list.list.strings.toLowerCase()");
- TestMetaModel mm = new TestMetaModel();
- ec = new ExecutionContextImpl();
- ec.registerMetaModel(mm);
- List<?> var = Collections.singletonList(mm.singleType.newInstance());
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable("x", var));
- List<String> result = (List<String>) eval (e);
- assertEquals(1, result.size());
- assertEquals("test", result.get(0));
- }
-
- public void testCollectShortCutWithOperationCalls() throws Exception {
- Expression e = parse("x.list().list().strings().toLowerCase()");
TestMetaModel mm = new TestMetaModel();
ec = new ExecutionContextImpl();
ec.registerMetaModel(mm);
- List<?> var = Collections.singletonList(mm.singleType.newInstance());
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable("x", var));
- List<String> result = (List<String>) eval (e);
- assertEquals(1, result.size());
- assertEquals("test", result.get(0));
- }
-
- public void testCollectShortCutWithMixedCalls() throws Exception {
- Expression e = parse("x.list.list().list.strings().toLowerCase()");
- TestMetaModel mm = new TestMetaModel();
- ec = new ExecutionContextImpl();
- ec.registerMetaModel(mm);
- List<?> var = Collections.singletonList(mm.singleType.newInstance());
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable("x", var));
- List<String> result = (List<String>) eval (e);
- assertEquals(1, result.size());
- assertEquals("test", result.get(0));
+
+ assertEquals (Arrays.asList("test"), eval ("x.list.list.strings.toLowerCase()", "x", Collections.singletonList(mm.singleType.newInstance())));
+ assertEquals (Arrays.asList("test"), eval ("x.list().list().strings().toLowerCase()", "x", Collections.singletonList(mm.singleType.newInstance())));
+ assertEquals (Arrays.asList("test"), eval ("x.list.list().list.strings().toLowerCase()", "x", Collections.singletonList(mm.singleType.newInstance())));
}
public void testCollectOnNull() throws Exception {
- Expression e = parse("null.collect(e|e.size)");
- assertNull(eval(e));
+ assertNull(eval("null.collect(e|e.size)"));
}
public void testEvaluationOrderOfOperands() throws Exception {
- Object x = new Object(){
- int c = 1;
- @Override
- public String toString() {
- return ""+c++;
- }
- };
- Expression e = parse("x.toString() + x.toString()");
- ec = new ExecutionContextImpl ();
- ec = (ExecutionContextImpl) ec.cloneWithVariable(new Variable("x",x));
- assertEquals("12",eval (e));
+ assertEquals("12",eval ("x.toString() + x.toString()", "x", new Cls ()));
+ }
+
+ public static class Cls {
+ int c = 1;
+ @Override
+ public String toString() {
+ return ""+c++;
+ }
}
}
diff --git a/tests/org.eclipse.xtend.middleend.old.test/src/org/eclipse/xtend/middleend/old/first/FirstAttempt.java b/tests/org.eclipse.xtend.middleend.old.test/src/org/eclipse/xtend/middleend/old/first/FirstAttempt.java
index 9000c40..da77609 100644
--- a/tests/org.eclipse.xtend.middleend.old.test/src/org/eclipse/xtend/middleend/old/first/FirstAttempt.java
+++ b/tests/org.eclipse.xtend.middleend.old.test/src/org/eclipse/xtend/middleend/old/first/FirstAttempt.java
@@ -34,11 +34,11 @@ public class FirstAttempt {
final List<MetaModel> mms = new ArrayList<MetaModel> ();
mms.add (new JavaBeansMetaModel ());
- final CompositeTypesystem ts = BackendTypesystemFactory.createWithoutUml();
+ final CompositeTypesystem ts = BackendTypesystemFactory.createJustEmf();
{
final XpandBackendFacade xp = XpandBackendFacade.createForFile ("org::eclipse::xtend::middleend::old::first::aTemplate", "iso-8859-1", mms, new ArrayList<Outlet>());
- final ExecutionContext ctx = BackendFacade.createExecutionContext (xp.getFunctionDefContext(), ts);
+ final ExecutionContext ctx = BackendFacade.createExecutionContext (xp.getFunctionDefContext(), ts, true);
System.err.println (BackendFacade.invoke (ctx, "org/eclipse/xtend/middleend/old/first/aTemplate/greeting", Arrays.asList("Arno")));
}
@@ -55,7 +55,7 @@ public class FirstAttempt {
{
final XtendBackendFacade bc = XtendBackendFacade.createForFile ("org::eclipse::xtend::middleend::old::first::first", "iso-8859-1", mms);
- final ExecutionContext ctx = BackendFacade.createExecutionContext (bc.getFunctionDefContext(), ts);
+ final ExecutionContext ctx = BackendFacade.createExecutionContext (bc.getFunctionDefContext(), ts, true);
System.err.println (BackendFacade.invoke (ctx, "test", Arrays.asList ("Arno")));
System.err.println (BackendFacade.invoke (ctx, "testColl", Arrays.asList (Arrays.asList (1L, "Hallo"))));