X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FERecord.java;h=47ef205df17cbce0d9ff1d74dd8f1154adc1bcfa;hp=8c8180a66299d7fa1f33a5c85e5ad13d77137ec3;hb=1b969e34d51e9a17a0038367a29b93c2822495ed;hpb=9c21f5837af6102a9dd05cb6a425bafe25576822 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java index 8c8180a66..47ef205df 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java @@ -46,16 +46,12 @@ public class ERecord extends ASTExpression { 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) @@ -73,7 +69,7 @@ public class ERecord extends ASTExpression { 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