]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphPropertyRelation.java
(refs #7278, refs #7279) Small fixes to InternalCompilerExceptions
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / scl / GraphPropertyRelation.java
index a6009426f36d7422473128b5be520f90ae7eefbd..307a32cccb1c6664cc7cc4dbf3fd96ea70f9a639 100644 (file)
@@ -3,6 +3,7 @@ package org.simantics.modeling.scl;
 import org.simantics.db.Resource;
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.common.names.Names;
+import org.simantics.scl.compiler.compilation.CompilationContext;
 import org.simantics.scl.compiler.elaboration.chr.plan.PlanContext;
 import org.simantics.scl.compiler.elaboration.expressions.EApply;
 import org.simantics.scl.compiler.elaboration.expressions.EExternalConstant;
@@ -120,22 +121,22 @@ public class GraphPropertyRelation implements SCLRelation {
     @Override
     public void generateIterate(PlanContext context, CodeWriter w, long location, int boundMask, Variable[] variables,
             Expression[] expressions, Expression[] typeConstraintEvidenceParameters) {
-        Environment env = context.context.environment;
+        CompilationContext compilationContext = context.context;
         switch(boundMask) {
         case BF:
             context.iterateMaybe(location, w, variables[1],
                     w.apply(location,
-                            env.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType),
-                            typeConstraintEvidenceParameters[0].toVal(env, w),
-                            expressions[0].toVal(env, w),
+                            compilationContext.environment.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType),
+                            typeConstraintEvidenceParameters[0].toVal(compilationContext, w),
+                            expressions[0].toVal(compilationContext, w),
                             w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE)));
             break;
         case BB:
-            context.checkEqualsJust(location, w, expressions[1].toVal(env, w),
+            context.checkEqualsJust(location, w, expressions[1].toVal(compilationContext, w),
                     w.apply(location,
-                            env.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType),
-                            typeConstraintEvidenceParameters[0].toVal(env, w),
-                            expressions[0].toVal(env, w),
+                            compilationContext.environment.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType),
+                            typeConstraintEvidenceParameters[0].toVal(compilationContext, w),
+                            expressions[0].toVal(compilationContext, w),
                             w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE)));
             break;
         default: throw new IllegalArgumentException();
@@ -144,12 +145,12 @@ public class GraphPropertyRelation implements SCLRelation {
 
     @Override
     public void generateEnforce(PlanContext context, CodeWriter w, long location, Expression[] parameters, Expression[] typeConstraintEvidenceParameters) {
-        Environment env = context.context.environment;
+        CompilationContext compilationContext = context.context;
         w.apply(location,
-                env.getValue(CLAIM_RELATED_VALUE).getValue().createSpecialization(valueType),
-                typeConstraintEvidenceParameters[0].toVal(env, w),
-                parameters[0].toVal(env, w),
+                compilationContext.environment.getValue(CLAIM_RELATED_VALUE).getValue().createSpecialization(valueType),
+                typeConstraintEvidenceParameters[0].toVal(compilationContext, w),
+                parameters[0].toVal(compilationContext, w),
                 w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE),
-                parameters[1].toVal(env, w));
+                parameters[1].toVal(compilationContext, w));
     }
 }