package org.simantics.scl.compiler.internal.interpreted; import org.simantics.scl.runtime.function.Function; public class IApply implements IExpression { private final IExpression function; private final IExpression[] parameters; public IApply(IExpression function, IExpression[] parameters) { if(function instanceof IApply) { IApply apply = (IApply)function; this.function = apply.function; this.parameters = new IExpression[apply.parameters.length + parameters.length]; System.arraycopy(apply.parameters, 0, this.parameters, 0, apply.parameters.length); System.arraycopy(parameters, 0, this.parameters, apply.parameters.length, parameters.length); } else { this.function = function; this.parameters = parameters; } } @SuppressWarnings("rawtypes") @Override public Object execute(Object[] variableBindings) { Object[] parameterValues = new Object[parameters.length]; for(int i=0;i