summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahaase2008-03-19 16:08:26 (EDT)
committerahaase2008-03-19 16:08:26 (EDT)
commit10a058dca1e6a1c6e0f725c696b0cf71da45c9ba (patch)
treecd6599dcaeb3bf996316d83c2569c506936a8632
parent531b73e345fab713877cdf0eee6c27cdffdd90bf (diff)
downloadorg.eclipse.xpand-10a058dca1e6a1c6e0f725c696b0cf71da45c9ba.zip
org.eclipse.xpand-10a058dca1e6a1c6e0f725c696b0cf71da45c9ba.tar.gz
org.eclipse.xpand-10a058dca1e6a1c6e0f725c696b0cf71da45c9ba.tar.bz2
reverted to good layout
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/functions/SourceDefinedFunction.java82
1 files changed, 41 insertions, 41 deletions
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 ed95c11..e45eda0 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,53 +18,53 @@ import org.eclipse.xtend.backend.common.ExpressionBase;
import org.eclipse.xtend.backend.common.LocalVarContext;
import org.eclipse.xtend.backend.common.StacktraceEntry;
+
/**
*
* @author Arno Haase (http://www.haase-consulting.com)
*/
public final class SourceDefinedFunction extends AbstractFunction {
- private final String _name;
- private final List<String> _paramNames;
- private final ExpressionBase _def;
-
- public SourceDefinedFunction(String name, List<String> paramNames,
- List<BackendType> paramTypes, ExpressionBase def, boolean cached,
- ExpressionBase guard) {
- super(guard, paramTypes, cached);
- _name = name;
- _paramNames = paramNames;
- _def = def;
- }
-
- public Object invoke(ExecutionContext ctx, Object[] params) {
- final LocalVarContext lvc = new LocalVarContext();
- for (int i = 0; i < _paramNames.size(); i++) {
- lvc.getLocalVars().put(_paramNames.get(i), params[i]);
- }
-
- final LocalVarContext oldLvc = ctx.getLocalVarContext();
- try {
- ctx.setLocalVarContext(lvc);
+ private final String _name;
+ private final List<String> _paramNames;
+ private final ExpressionBase _def;
- if (ctx.isLogStacktrace())
- ctx.getStacktrace()
- .add(new StacktraceEntry(_def.getPos(), ctx));
+ public SourceDefinedFunction (String name, List<String> paramNames, List<BackendType> paramTypes, ExpressionBase def, boolean cached, ExpressionBase guard) {
+ super (guard, paramTypes, cached);
+ _name = name;
+ _paramNames = paramNames;
+ _def = def;
+ }
- return _def.evaluate(ctx);
- } finally {
- if (ctx.isLogStacktrace())
- ctx.getStacktrace().remove(ctx.getStacktrace().size() - 1);
+ public Object invoke (ExecutionContext ctx, Object[] params) {
+ final LocalVarContext lvc = new LocalVarContext ();
+ for (int i=0; i<_paramNames.size(); i++) {
+ lvc.getLocalVars().put(_paramNames.get(i), params[i]);
+ }
+
+ 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);
+ }
+ }
- ctx.setLocalVarContext(oldLvc);
- }
- }
-
- @Override
- public String toString() {
- return "SourceDefinedFunction '" + _name + "' " + getParameterTypes();
- }
-
- public String getName() {
- return _name;
- }
+ public String getName () {
+ return _name;
+ }
+
+ @Override
+ public String toString () {
+ return "SourceDefinedFunction '" + _name + "' " + getParameterTypes();
+ }
}
+