package jetbrains.mps.baseLanguage.dataFlow;
/*Generated by MPS */
import jetbrains.mps.lang.dataFlow.framework.DataFlowConstructor;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.dataFlow.framework.Program;
import jetbrains.mps.baseLanguage.behavior.NextProgramPoint;
import jetbrains.mps.baseLanguage.behavior.IConditional__BehaviorDescriptor;
import jetbrains.mps.lang.dataFlow.framework.instructions.Instruction;
public class RuleEqualsExpression implements DataFlowConstructor {
public boolean isApplicable(SNode node) {
SAbstractConcept concept = SNodeOperations.getConcept(node);
SAbstractConcept applicableConcept = getApplicableConcept();
return concept.equals(applicableConcept) || concept.isSubConceptOf(applicableConcept);
}
public SAbstractConcept getApplicableConcept() {
return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b210L, "jetbrains.mps.baseLanguage.structure.EqualsExpression");
}
public void performActions(Program o, SNode node) {
SNode otherThanNull = NullableUtil.getOtherThanNull(node);
if (otherThanNull == null) {
return;
}
if (!((SNodeOperations.isInstanceOf(SNodeOperations.getParent(node), MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3ac89e1b122cd5c2L, "jetbrains.mps.baseLanguage.structure.IConditional"))))) {
return;
}
NextProgramPoint point = IConditional__BehaviorDescriptor.getNextProgramPoint_id3F8BxGibk8h.invoke(SNodeOperations.cast(SNodeOperations.getParent(node), MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3ac89e1b122cd5c2L, "jetbrains.mps.baseLanguage.structure.IConditional")), node, ((boolean) true));
if (point != null) {
if (point.willJump()) {
{
Object object = node;
if (((Program) o).contains(object)) {
boolean before = false;
int position = ((Program) (o)).getEnd(object);
Instruction instruction = new nullInstruction(otherThanNull);
instruction.setRuleReference("r:00000000-0000-4000-0000-011c895902c2(jetbrains.mps.baseLanguage.dataFlow)/1383888600189576263");
instruction.setSource(node);
((Program) (o)).insert(instruction, position, true, before);
}
}
} else {
assert !(point.isAfter());
{
Object object = point.getSucceedingNode();
if (((Program) o).contains(object)) {
boolean before = true;
int position = ((Program) (o)).getStart(point.getSucceedingNode());
Instruction instruction = new nullInstruction(otherThanNull);
instruction.setRuleReference("r:00000000-0000-4000-0000-011c895902c2(jetbrains.mps.baseLanguage.dataFlow)/1383888600189574816");
instruction.setSource(node);
((Program) (o)).insert(instruction, position, true, before);
}
}
}
}
point = IConditional__BehaviorDescriptor.getNextProgramPoint_id3F8BxGibk8h.invoke(SNodeOperations.cast(SNodeOperations.getParent(node), MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3ac89e1b122cd5c2L, "jetbrains.mps.baseLanguage.structure.IConditional")), node, ((boolean) false));
if (point != null) {
if (point.willJump()) {
{
Object object = node;
if (((Program) o).contains(object)) {
boolean before = false;
int position = ((Program) (o)).getEnd(object);
Instruction instruction = new notNullInstruction(otherThanNull);
instruction.setRuleReference("r:00000000-0000-4000-0000-011c895902c2(jetbrains.mps.baseLanguage.dataFlow)/4235809288651577795");
instruction.setSource(node);
((Program) (o)).insert(instruction, position, true, before);
}
}
} else {
assert !(point.isAfter());
{
Object object = point.getSucceedingNode();
if (((Program) o).contains(object)) {
boolean before = true;
int position = ((Program) (o)).getStart(point.getSucceedingNode());
Instruction instruction = new notNullInstruction(otherThanNull);
instruction.setRuleReference("r:00000000-0000-4000-0000-011c895902c2(jetbrains.mps.baseLanguage.dataFlow)/4235809288651577807");
instruction.setSource(node);
((Program) (o)).insert(instruction, position, true, before);
}
}
}
}
}
}