public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   {
     boolean b =
         SModelUtil_new.isAssignableConcept(
             argument.getConcept().getConceptId(), this.getApplicableConceptFQName());
     return new IsApplicableStatus(b, null);
   }
 }
 public IsApplicableStatus isApplicableSupertypeAndPattern(SNode node) {
   {
     boolean b =
         SModelUtil_new.isAssignableConcept(
             node.getConcept().getConceptId(), this.getApplicableSupertypeConceptFQName());
     return new IsApplicableStatus(b, null);
   }
 }
 public IsApplicableStatus isApplicableFirst(SNode node) {
   {
     boolean b =
         SModelUtil_new.isAssignableConcept(
             node.getConceptFqName(), this.getApplicableConceptFQName1());
     return new IsApplicableStatus(b, null);
   }
 }
예제 #4
0
 public boolean isApplicable(SNode node) {
   return SModelUtil_new.isAssignableConcept(
       BehaviorReflection.invokeVirtual(
           String.class,
           SNodeOperations.getConceptDeclaration(node),
           "virtual_getFqName_1213877404258",
           new Object[] {}),
       getApplicableConceptFqName());
 }
  public void applyRule(
      final SNode catchClause,
      final TypeCheckingContext typeCheckingContext,
      IsApplicableStatus status) {
    final SNode caughtType =
        SLinkOperations.getTarget(
            SLinkOperations.getTarget(catchClause, "throwable", true), "type", true);
    if (SNodeOperations.isInstanceOf(
        caughtType, "jetbrains.mps.baseLanguage.structure.ClassifierType")) {
      SNode caughtClassifier =
          SLinkOperations.getTarget(
              SNodeOperations.cast(
                  caughtType, "jetbrains.mps.baseLanguage.structure.ClassifierType"),
              "classifier",
              false);
      if (TypeChecker.getInstance()
              .getSubtypingManager()
              .isSubtype(caughtType, _quotation_createNode_r5g8rc_b0a0a0b0b0b())
          || TypeChecker.getInstance()
              .getSubtypingManager()
              .isSubtype(caughtType, _quotation_createNode_r5g8rc_b0a0a0b0b0b_0())
          || caughtClassifier
              == SNodeOperations.getNode(
                  "f:java_stub#6354ebe7-c22a-4a0f-ac54-50b52ab9b065#java.lang(JDK/java.lang@java_stub)",
                  "~Exception")
          || caughtClassifier
              == SNodeOperations.getNode(
                  "f:java_stub#6354ebe7-c22a-4a0f-ac54-50b52ab9b065#java.lang(JDK/java.lang@java_stub)",
                  "~Throwable")) {
        // ignore
      } else {
        Set<SNode> thrown = SetSequence.fromSet(new HashSet<SNode>());
        {
          SNode matchedNode_13ophr_b0a1a1a = SNodeOperations.getParent(catchClause);
          {
            boolean matches_13ophr_a1a0b0b0 = false;
            {
              SNode matchingNode_13ophr_a1a0b0b0 = SNodeOperations.getParent(catchClause);
              if (matchingNode_13ophr_a1a0b0b0 != null) {
                matches_13ophr_a1a0b0b0 =
                    SModelUtil_new.isAssignableConcept(
                        matchingNode_13ophr_a1a0b0b0.getConcept().getConceptId(),
                        "jetbrains.mps.baseLanguage.structure.TryCatchStatement");
              }
            }
            if (matches_13ophr_a1a0b0b0) {
              thrown =
                  StatementList_Behavior.call_uncaughtThrowables_3331512479731115649(
                      SLinkOperations.getTarget(matchedNode_13ophr_b0a1a1a, "body", true), false);
            } else {
              boolean matches_13ophr_b1a0b0b0 = false;
              {
                SNode matchingNode_13ophr_b1a0b0b0 = SNodeOperations.getParent(catchClause);
                if (matchingNode_13ophr_b1a0b0b0 != null) {
                  matches_13ophr_b1a0b0b0 =
                      SModelUtil_new.isAssignableConcept(
                          matchingNode_13ophr_b1a0b0b0.getConcept().getConceptId(),
                          "jetbrains.mps.baseLanguage.structure.TryStatement");
                }
              }
              if (matches_13ophr_b1a0b0b0) {
                thrown =
                    StatementList_Behavior.call_uncaughtThrowables_3331512479731115649(
                        SLinkOperations.getTarget(matchedNode_13ophr_b0a1a1a, "body", true), false);
              }
            }
          }
        }

        if (!(SetSequence.fromSet(thrown)
            .any(
                new IWhereFilter<SNode>() {
                  public boolean accept(SNode t) {
                    return TypeChecker.getInstance()
                            .getSubtypingManager()
                            .isSubtype(
                                _quotation_createNode_r5g8rc_a0a0a0a0a0d0a1a1a1(t), caughtType)
                        || TypeChecker.getInstance()
                            .getSubtypingManager()
                            .isSubtype(
                                caughtType, _quotation_createNode_r5g8rc_b0a0a0a0a0d0a1a1a1(t));
                  }
                }))) {
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    SLinkOperations.getTarget(catchClause, "throwable", true),
                    "Caught exception "
                        + caughtType
                        + " is never thrown in the corresponding try block",
                    "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                    "8512491756795014519",
                    null,
                    errorTarget);
          }
        }
      }
    }
  }