]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java
Minor refactorings related to SCL constructors
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / ERecord.java
index 8c8180a66299d7fa1f33a5c85e5ad13d77137ec3..47ef205df17cbce0d9ff1d74dd8f1154adc1bcfa 100644 (file)
@@ -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