context.getErrorLog().log(constructor.location, "Couldn't resolve the record constructor " + constructor.name + ".");
return new EError(constructor.location);
}
- if(!(constructorValue.getValue() instanceof SCLConstructor)) {
+ String[] parameterNames = constructorValue.parameterNames;
+ if(parameterNames == null) {
context.getErrorLog().log(constructor.location, "Value " + constructor.name + " is not a record constructor.");
return new EError(constructor.location);
}
- String[] fieldNames = ((SCLConstructor)constructorValue.getValue()).recordFieldNames;
- if(fieldNames == null) {
- context.getErrorLog().log(constructor.location, "Value " + constructor.name + " is not a record constructor.");
- return new EError(constructor.location);
- }
- Expression[] parameters = translateFieldsToFunctionParameters(context, fields, fieldNames, false);
+ Expression[] parameters = translateFieldsToFunctionParameters(context, fields, parameterNames, false);
if(parameters == null)
return new EError(location);
if(asPattern)
if(parameter == null) {
ExistentialFrame frame = context.getCurrentExistentialFrame();
if(frame == null || frame.disallowNewExistentials) {
- context.getErrorLog().log(location, "Field " + fieldNames[i] + " not defined.");
+ context.getErrorLog().log(location, "Field " + parameterNames[i] + " not defined.");
error = true;
}
else
String variableName = fieldNames[i];
if(chrLiteral)
variableName = "?" + variableName;
- parameters[i] = new EVar(wildcardField.location, variableName);
+ EVar expandedVar = new EVar(wildcardField.location, variableName);
+ parameters[i] = expandedVar;
+ context.addExpandedFromWildcard(expandedVar);
}
}
if(!recordMap.isEmpty()) {