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.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.lang.dataFlow.framework.instructions.Instruction; public class RuleMethodCall 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.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, "jetbrains.mps.baseLanguage.structure.IMethodCall"); } public void performActions(Program o, SNode node) { SNode m = node; SNode targetNode = node; while (SNodeOperations.isInstanceOf(SNodeOperations.getParent(targetNode), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, "jetbrains.mps.baseLanguage.structure.DotExpression")) && SLinkOperations.getTarget(SNodeOperations.cast(SNodeOperations.getParent(targetNode), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, "jetbrains.mps.baseLanguage.structure.DotExpression")), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x116b46a08c4L, 0x116b46b36c4L, "operation")) == targetNode) { targetNode = SNodeOperations.getParent(targetNode); } if (SLinkOperations.getChildren(SLinkOperations.getTarget(m, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration")), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6be947aL, 0x114a6beb0bdL, "annotation")) != null) { for (SNode annotation : SLinkOperations.getChildren(SLinkOperations.getTarget(m, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11857355952L, 0xf8c78301adL, "baseMethodDeclaration")), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6be947aL, 0x114a6beb0bdL, "annotation"))) { if (SLinkOperations.getTarget(annotation, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation")) == SNodeOperations.getNode("3f233e7f-b8a6-46d2-a57f-795d56775243/java:org.jetbrains.annotations(Annotations/)", "~Nullable")) { { Object object = node; if (((Program) o).contains(object)) { boolean before = false; int position = ((Program) (o)).getEnd(object); Instruction instruction = new nullableInstruction(targetNode); instruction.setRuleReference("r:00000000-0000-4000-0000-011c895902c2(jetbrains.mps.baseLanguage.dataFlow)/6868777471677432528"); instruction.setSource(node); ((Program) (o)).insert(instruction, position, true, before); } } } if (SLinkOperations.getTarget(annotation, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation")) == SNodeOperations.getNode("3f233e7f-b8a6-46d2-a57f-795d56775243/java:org.jetbrains.annotations(Annotations/)", "~NotNull")) { { Object object = node; if (((Program) o).contains(object)) { boolean before = false; int position = ((Program) (o)).getEnd(object); Instruction instruction = new notNullInstruction(targetNode); instruction.setRuleReference("r:00000000-0000-4000-0000-011c895902c2(jetbrains.mps.baseLanguage.dataFlow)/6868777471677432540"); instruction.setSource(node); ((Program) (o)).insert(instruction, position, true, before); } } } } } } }