]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Accept existential variables as record shorthand fields"
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Tue, 11 Apr 2017 09:30:14 +0000 (12:30 +0300)
committerGerrit Code Review <gerrit2@www.simantics.org>
Tue, 11 Apr 2017 09:30:14 +0000 (12:30 +0300)
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java

index 6ef9e9e72b4f69ef878e244484edc97880219cf1..a41c0f042d46034e782ec06b78888bfe146cf7c9 100644 (file)
@@ -54,11 +54,14 @@ public class ERecord extends ASTExpression {
         THashMap<String,FieldAssignment> recordMap = new THashMap<String,FieldAssignment>(fields.length);
         for(FieldAssignment field : fields) {
             if(field.value == null) {
+               String actualName = field.name;
+               if(actualName.charAt(0) == '?')
+                       actualName = actualName.substring(1);
                 String bestMatch = null;
                 int bestMatchLength = 0;
                 for(int i=0;i<fieldNames.length;++i) {
                     String fieldName = fieldNames[i];
-                    if(field.name.startsWith(fieldName) && fieldName.length() > bestMatchLength) {
+                    if(actualName.startsWith(fieldName) && fieldName.length() > bestMatchLength) {
                         bestMatch = fieldName;
                         bestMatchLength = fieldName.length();
                     }