public void applyRule(
     final SNode classifier,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   List<SNode> ownMethods = Classifier_Behavior.call_getOwnMethods_1906502351318572840(classifier);
   ClassifierAndSuperClassifiersScope scope =
       new ClassifierAndSuperClassifiersScope(
           classifier,
           IClassifiersSearchScope.INSTANCE_METHOD | IClassifiersSearchScope.STATIC_METHOD);
   for (SNode ownMethod : ownMethods) {
     List<SNode> namesakes =
         scope.getMethodsByName(SPropertyOperations.getString(ownMethod, "name"));
     if (namesakes.size() < 2) {
       continue;
     }
     RulesFunctions_BaseLanguage.checkDuplicates(
         typeCheckingContext, ownMethod, classifier, namesakes);
   }
 }
Esempio n. 2
0
  public static List<SNode> virtual_getMethodsToImplement_5418393554803775106(SNode thisNode) {
    List<SNode> methods = new ArrayList<SNode>();
    ClassifierAndSuperClassifiersScope scope =
        new ClassifierAndSuperClassifiersScope(thisNode, IClassifiersSearchScope.INSTANCE_METHOD);
    // todo do not show already implemented methods
    for (SNode method : ((List<SNode>) scope.getNodes())) {
      boolean isOverridden = false;
      List<SNode> overridenMethods = scope.getOverriddenMethods(method);
      for (SNode overridingMethod : overridenMethods) {
        isOverridden =
            isOverridden
                || (SNodeOperations.isInstanceOf(
                        overridingMethod,
                        "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration")
                    && SPropertyOperations.getBoolean(
                        SNodeOperations.getConceptDeclaration(
                            SNodeOperations.cast(
                                overridingMethod,
                                "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration")),
                        "abstract"));
      }
      if (isOverridden) {
        continue;
      }

      SNode container =
          SNodeOperations.getAncestor(
              method, "jetbrains.mps.baseLanguage.structure.Classifier", false, false);
      if (container == thisNode || container == null) {
        continue;
      }
      if (SNodeOperations.isInstanceOf(container, "jetbrains.mps.baseLanguage.structure.Interface")
          || SPropertyOperations.getBoolean(method, "isAbstract")) {
        ListSequence.fromList(methods).addElement(method);
      }
    }
    return methods;
  }