]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/EnvironmentOfModule.java
(refs #7250) Merging master, minor CHR bugfixes
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / compilation / EnvironmentOfModule.java
index a2324970962b67027100e96c9c3c529197e443c3..fd70d368d96cb7e6fbedf004c41c58d04dbf1534 100644 (file)
@@ -2,13 +2,14 @@ package org.simantics.scl.compiler.compilation;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.simantics.scl.compiler.common.names.Name;
+import org.simantics.scl.compiler.constants.Constant;
 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
-import org.simantics.scl.compiler.elaboration.modules.TypeAlias;
 import org.simantics.scl.compiler.elaboration.modules.TypeClass;
 import org.simantics.scl.compiler.elaboration.modules.TypeClassInstance;
-import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
+import org.simantics.scl.compiler.elaboration.modules.TypeDescriptor;
 import org.simantics.scl.compiler.elaboration.relations.SCLEntityType;
 import org.simantics.scl.compiler.elaboration.relations.SCLRelation;
 import org.simantics.scl.compiler.elaboration.rules.TransformationRule;
@@ -41,6 +42,21 @@ public class EnvironmentOfModule implements Environment {
         else
             return base.getValue(name);
     }
+    
+    @Override
+    public List<Constant> getFieldAccessors(String name) {
+        List<Constant> r1 = base.getFieldAccessors(name);
+        List<Constant> r2 = module.getFieldAccessors(name);
+        if(r1 == null)
+            return r2;
+        if(r2 == null)
+            return r1;
+        ArrayList<Constant> result = new ArrayList<Constant>(r1.size() + r2.size());
+        result.addAll(r1);
+        result.addAll(r2);
+        return result;
+    }
+    
     @Override
     public SCLRelation getRelation(Name name) {
         if(name.module.equals(module.getName()))
@@ -56,11 +72,11 @@ public class EnvironmentOfModule implements Environment {
             return base.getEntityType(name);
     }
     @Override
-    public TypeConstructor getTypeConstructor(TCon type) {
+    public TypeDescriptor getTypeDescriptor(TCon type) {
         if(type.module.equals(module.getName()))
-            return module.getTypeConstructor(type.name);
+            return module.getTypeDescriptor(type.name);
         else
-            return base.getTypeConstructor(type);
+            return base.getTypeDescriptor(type);
     }
     @Override
     public EffectConstructor getEffectConstructor(TCon type) {
@@ -70,13 +86,6 @@ public class EnvironmentOfModule implements Environment {
             return base.getEffectConstructor(type);
     }
     @Override
-    public TypeAlias getTypeAlias(TCon type) {
-        if(type.module.equals(module.getName()))
-            return module.getTypeAlias(type.name);
-        else
-            return base.getTypeAlias(type);
-    }
-    @Override
     public TypeClass getTypeClass(TCon type) {
         if(type.module.equals(module.getName()))
             return module.getTypeClass(type.name);