+
+ public void checkEquals(long location, CodeWriter w, IVal a, IVal b) {
+ check(location, w, w.apply(location,
+ EqualsFunction.INSTANCE.createSpecialization(a.getType()),
+ a, b));
+ }
+
+ public void checkEqualsJust(long location, CodeWriter w, IVal value, IVal maybeValue) {
+ Type componentType = value.getType();
+
+ CodeWriter end = w.createBlock();
+ CodeWriter body = w.createBlock(componentType);
+ w.switch_(maybeValue, new Branch[] {
+ new Branch(JustConstant.INSTANCE, body.getContinuation()),
+ new Branch(null, end.getContinuation())
+ });
+ body.branchAwayUnless(body.apply(location,
+ EqualsFunction.INSTANCE.createSpecialization(componentType),
+ value, body.getParameters()[0]), end.getContinuation());
+ nextOp(body);
+ if(body.isUnfinished())
+ body.jump(end.getContinuation());
+
+ w.continueAs(end);
+ }
+
+ public IVal getStoreVar(CHRConstraint constraint) {
+ IncludeStatement includeStatement = ruleset.constraintSourceMap.get(constraint);
+ if(includeStatement != null)
+ return includeStatement.storeVar;
+ else
+ return mainStoreVar;
+ }