]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphPropertyRelation.java
Merged changes from feature/scl to master.
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / scl / GraphPropertyRelation.java
index 45ac24f1c7ad4f5913e933f3448b90f82d9d483f..4e450005b24b100f13b90b2bdeeb576f46a0aca9 100644 (file)
@@ -2,6 +2,8 @@ package org.simantics.modeling.scl;
 \r
 import org.simantics.db.Resource;\r
 import org.simantics.scl.compiler.common.names.Name;\r
+import org.simantics.scl.compiler.common.names.Names;\r
+import org.simantics.scl.compiler.elaboration.chr.plan.PlanContext;\r
 import org.simantics.scl.compiler.elaboration.expressions.EApply;\r
 import org.simantics.scl.compiler.elaboration.expressions.EExternalConstant;\r
 import org.simantics.scl.compiler.elaboration.expressions.EVariable;\r
@@ -10,7 +12,9 @@ import org.simantics.scl.compiler.elaboration.expressions.Variable;
 import org.simantics.scl.compiler.elaboration.query.compilation.EnforcingContext;\r
 import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;\r
 import org.simantics.scl.compiler.elaboration.relations.SCLRelation;\r
+import org.simantics.scl.compiler.environment.Environment;\r
 import org.simantics.scl.compiler.errors.Locations;\r
+import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;\r
 import org.simantics.scl.compiler.types.TVar;\r
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.Types;\r
@@ -63,7 +67,7 @@ public class GraphPropertyRelation implements SCLRelation {
         Expression possibleValue = new EApply(\r
                 Locations.NO_LOCATION,\r
                 Types.READ_GRAPH,\r
-                context.getTypingContext().getConstant(POSSIBLE_RELATED_VALUE, valueType),\r
+                context.getCompilationContext().getConstant(POSSIBLE_RELATED_VALUE, valueType),\r
                 context.getEvidence(location, Types.pred(Types.SERIALIZABLE, valueType)),\r
                 new EVariable(parameters[0]),\r
                 new EExternalConstant(propertyRelation, RESOURCE)\r
@@ -72,9 +76,8 @@ public class GraphPropertyRelation implements SCLRelation {
         case BB: {\r
             Variable temp = new Variable("temp", valueType);\r
             context.condition(new EApply(\r
-                    context.getTypingContext().getConstant(Name.create("Prelude", "=="), valueType),\r
+                    context.getCompilationContext().getConstant(Names.Builtin_equals, valueType),\r
                     new Expression[] {\r
-                        context.getEvidence(location, Types.pred(Types.EQ, valueType)),\r
                         new EVariable(temp),\r
                         new EVariable(parameters[1])\r
                     }\r
@@ -95,7 +98,7 @@ public class GraphPropertyRelation implements SCLRelation {
         return new EApply(\r
                 Locations.NO_LOCATION,\r
                 Types.WRITE_GRAPH,\r
-                context.getTypingContext().getConstant(CLAIM_RELATED_VALUE, valueType),\r
+                context.getCompilationContext().getConstant(CLAIM_RELATED_VALUE, valueType),\r
                 context.getEvidence(location, Types.pred(Types.SERIALIZABLE, valueType)),\r
                 new EVariable(parameters[0]),\r
                 new EExternalConstant(propertyRelation, RESOURCE),\r
@@ -108,4 +111,14 @@ public class GraphPropertyRelation implements SCLRelation {
         return 0;\r
     }\r
     \r
+    @Override\r
+    public void generateEnforce(PlanContext context, CodeWriter w, long location, Expression[] parameters) {\r
+        throw new UnsupportedOperationException(getClass().getSimpleName() + " does not support enforce.");\r
+    }\r
+    \r
+    @Override\r
+    public void generateIterate(PlanContext context, CodeWriter w, long location, int boundMask, Variable[] variables,\r
+            Expression[] expressions) {\r
+        throw new UnsupportedOperationException(getClass().getSimpleName() + " does not support iterate.");\r
+    }\r
 }\r