org.rascalmpl.interpreter.AssignableEvaluator.__getTf()
.nodeType(), __eval.__getValue().getType(),
this);
}
IConstructor node = (IConstructor) __eval.__getValue().getValue();
Type nodeType = node.getType();
if (nodeType.isAbstractData()) {
nodeType = ((IConstructor) __eval.__getValue().getValue())
.getConstructorType();
}
if (!node.getName().equals(
org.rascalmpl.interpreter.utils.Names.name(this.getName()))) {
throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
.nameMismatch(node.getName(),
org.rascalmpl.interpreter.utils.Names.name(this
.getName()), this.getName(), __eval
.__getEval().getStackTrace());
}
List<org.rascalmpl.ast.Assignable> arguments = this.getArguments();
if (node.arity() != arguments.size()) {
throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
.arityMismatch(node.arity(), arguments.size(), this,
__eval.__getEval().getStackTrace());
}
IValue[] results = new IValue[arguments.size()];
Type[] resultTypes = new Type[arguments.size()];
for (int i = 0; i < arguments.size(); i++) {
Type argType = !nodeType.isConstructor() ? org.rascalmpl.interpreter.AssignableEvaluator
.__getTf().valueType()
: nodeType.getFieldType(i);
IValue arg = node.get(i);
Result<IValue> result = org.rascalmpl.interpreter.result.ResultFactory
.makeResult(argType, arg, __eval.__getEval());
AssignableEvaluator ae = new AssignableEvaluator(__eval
.__getEnv(), null, result, __eval.__getEval());
Result<IValue> argResult = arguments.get(i).assignment(ae);
results[i] = argResult.getValue();
resultTypes[i] = argType;
}
if (!nodeType.isAbstractData() && !nodeType.isConstructor()) {
// TODO: can this be the case?
return org.rascalmpl.interpreter.result.ResultFactory
.makeResult(nodeType, __eval.__getEval()
.getValueFactory().node(node.getName(), results),
__eval.__getEval());
}
Type constructor = __eval.__getEval().getCurrentEnvt()
.getConstructor(
node.getName(),
org.rascalmpl.interpreter.AssignableEvaluator
.__getTf().tupleType(resultTypes));
if (constructor == null) {
throw new ImplementationError("could not find constructor for "
+ node.getName()
+ " : "
+ org.rascalmpl.interpreter.AssignableEvaluator
.__getTf().tupleType(resultTypes));
}