private static boolean isReversedSubTypeOperator(SNode subOperator, SNode superOperator) {
   if (TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           SLinkOperations.getTarget(superOperator, "rightType", true),
           SLinkOperations.getTarget(subOperator, "leftType", true),
           false)) {
     return false;
   }
   if (TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           SLinkOperations.getTarget(subOperator, "leftType", true),
           SLinkOperations.getTarget(superOperator, "rightType", true),
           false)) {
     return true;
   }
   if (TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           SLinkOperations.getTarget(superOperator, "leftType", true),
           SLinkOperations.getTarget(subOperator, "rightType", true),
           false)) {
     return false;
   }
   return true;
 }
 @Override
 protected InequalitySystem getInequalitiesSystem(EditorCell contextCell) {
   HashMap<SNode, SNode> mapping = new HashMap<SNode, SNode>();
   CopyUtil.copy(Arrays.asList(mySourceNode.getContainingRoot()), mapping).get(0);
   SNode nodeToEquatePeer = mySourceNode;
   TypeChecker typeChecker = TypeChecker.getInstance();
   while (nodeToEquatePeer != null && typeChecker.getTypeOf(nodeToEquatePeer) == null) {
     nodeToEquatePeer = nodeToEquatePeer.getParent();
   }
   if (nodeToEquatePeer == null) {
     return null;
   }
   SNode nodeToEquate = mapping.get(nodeToEquatePeer);
   SNode parent = nodeToEquate.getParent();
   if (parent == null) {
     return null;
   }
   SNode hole =
       SModelUtil_new.instantiateConceptDeclaration(
           jetbrains.mps.smodel.SNodeUtil.concept_BaseConcept, null, null, true);
   SNodeUtil.replaceWithAnother(nodeToEquate, hole);
   InequalitySystem inequalitiesForHole =
       TypeChecker.getInstance().getInequalitiesForHole(hole, false);
   return inequalitiesForHole;
 }
Example #3
0
 public static boolean baseMappingRule_Condition_1196428788645(
     final BaseMappingRuleContext _context) {
   return SNodeOperations.isInstanceOf(
           TypeChecker.getInstance()
               .getTypeOf(
                   SLinkOperations.getTarget(
                       _context.getNode(),
                       MetaAdapterFactory.getContainmentLink(
                           0xf3061a5392264cc5L,
                           0xa443f952ceaf5816L,
                           0xfbdeb6fecfL,
                           0xfbdeb7a11cL,
                           "leftExpression"))),
           MetaAdapterFactory.getConcept(
               0xff24ab03965e4d15L,
               0x9aed52dc276658f4L,
               0x11686a0422aL,
               "jetbrains.mps.samples.complex.structure.ComplexType"))
       && TypeChecker.getInstance()
           .getSubtypingManager()
           .isSubtype(
               TypeChecker.getInstance()
                   .getTypeOf(
                       SLinkOperations.getTarget(
                           _context.getNode(),
                           MetaAdapterFactory.getContainmentLink(
                               0xf3061a5392264cc5L,
                               0xa443f952ceaf5816L,
                               0xfbdeb6fecfL,
                               0xfbdeb7a11bL,
                               "rightExpression"))),
               _quotation_createNode_x583g4_b0a0a0c());
 }
Example #4
0
 public static Object propertyMacro_GetPropertyValue_3524394717035465437(
     final IOperationContext operationContext, final PropertyMacroContext _context) {
   SNode op =
       BinaryOperationUtil.getNearestOverloaded(
           _context.getNode(),
           TypeChecker.getInstance()
               .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "leftExpression", true)),
           TypeChecker.getInstance()
               .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "rightExpression", true)),
           ListSequence.fromList(
                   SModelOperations.getRootsIncludingImported(
                       SNodeOperations.getModel(_context.getNode()),
                       _context.getScope(),
                       "jetbrains.mps.baseLanguage.overloadedOperators.structure.OverloadedOperatorContainer"))
               .translate(
                   new ITranslator2<SNode, SNode>() {
                     public Iterable<SNode> translate(SNode it) {
                       return SLinkOperations.getTargets(it, "operators", true);
                     }
                   })
               .toListSequence());
   return BehaviorReflection.invokeVirtual(
       String.class,
       SNodeOperations.cast(
           SNodeOperations.getParent(op),
           "jetbrains.mps.baseLanguage.overloadedOperators.structure.OverloadedOperatorContainer"),
       "virtual_getFqName_1213877404258",
       new Object[] {});
 }
 public void applyRule(
     final SNode part, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   SNode returnType =
       TypeChecker.getInstance().getTypeOf(SLinkOperations.getTarget(part, "factoryMethod", true));
   if (!(TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(returnType, _quotation_createNode_5hdosv_b0a0b0a()))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               part,
               "Factory method should return subtype of Iterable<AbstractMigrationRefactoring> (now \""
                   + BehaviorReflection.invokeVirtual(
                       String.class,
                       returnType,
                       "virtual_getPresentation_1213877396640",
                       new Object[] {})
                   + "\")",
               "r:00000000-0000-4000-0000-011c89590320(jetbrains.mps.lang.script.typesystem)",
               "2598676492883176352",
               null,
               errorTarget);
     }
   }
 }
Example #6
0
 public static SNode sourceNodeQuery_3524394717035465536(
     final IOperationContext operationContext, final SourceSubstituteMacroNodeContext _context) {
   BinaryOperationUtil.getNearestOverloaded(
       _context.getNode(),
       TypeChecker.getInstance()
           .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "leftExpression", true)),
       TypeChecker.getInstance()
           .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "rightExpression", true)),
       ListSequence.fromList(
               SModelOperations.getRootsIncludingImported(
                   SNodeOperations.getModel(_context.getNode()),
                   _context.getScope(),
                   "jetbrains.mps.baseLanguage.overloadedOperators.structure.OverloadedOperatorContainer"))
           .translate(
               new ITranslator2<SNode, SNode>() {
                 public Iterable<SNode> translate(SNode it) {
                   return SLinkOperations.getTargets(it, "operators", true);
                 }
               })
           .toListSequence());
   if ((Boolean) (_context.getNode().getUserObject("reversed"))) {
     return SLinkOperations.getTarget(_context.getNode(), "leftExpression", true);
   }
   return SLinkOperations.getTarget(_context.getNode(), "rightExpression", true);
 }
Example #7
0
 public static boolean ifMacro_Condition_3073231036165996124(
     final IOperationContext operationContext, final IfMacroContext _context) {
   return !(TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           TypeChecker.getInstance().getTypeOf(_context.getNode()),
           _quotation_createNode_x583g4_b0a0a0v()));
 }
Example #8
0
 public static List<SNode> getPossibleCatches(SNode source, List<SNode> catchClauses) {
   List<SNode> result = new ArrayList<SNode>();
   SNode statement =
       SNodeOperations.getNodeAncestor(
           source,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8cc56b215L,
               "jetbrains.mps.baseLanguage.structure.Statement"),
           false,
           false);
   Set<SNode> uncaughtThrowables =
       Statement_Behavior.call_uncaughtThrowables_5412515780383108857(statement, false);
   for (SNode catchClause : catchClauses) {
     SNode caughtType =
         SLinkOperations.getTarget(
             SLinkOperations.getTarget(
                 catchClause,
                 MetaAdapterFactory.getContainmentLink(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x10f39a56e2fL,
                     0x10f39a6a2f1L,
                     "throwable")),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x450368d90ce15bc3L,
                 0x4ed4d318133c80ceL,
                 "type"));
     if (TypeChecker.getInstance()
             .getSubtypingManager()
             .isSubtype(caughtType, _quotation_createNode_l1x7gt_b0a0a1a3a1())
         || TypeChecker.getInstance()
             .getSubtypingManager()
             .isSubtype(caughtType, _quotation_createNode_l1x7gt_b0a0a1a3a1_0())
         || TypeChecker.getInstance()
             .getSubtypingManager()
             .isSubtype(_quotation_createNode_l1x7gt_a0a0b0d0b(), caughtType)) {
       ListSequence.fromList(result).addElement(catchClause);
     } else {
       for (SNode throwed : uncaughtThrowables) {
         if (TypeChecker.getInstance()
             .getSubtypingManager()
             .isSubtype(_quotation_createNode_l1x7gt_a0a0a0a0b0d0b(throwed), caughtType)) {
           ListSequence.fromList(result).addElement(catchClause);
         }
       }
     }
   }
   return result;
 }
Example #9
0
 public static SNode getOutputNodeType_fromSourceQuery(SNode query) {
   if (query == null) {
     return _quotation_createNode_w9106s_a0a0a5();
   }
   SNode OutputType = TypeChecker.getInstance().getTypeOf(query);
   if (SNodeOperations.isInstanceOf(
       OutputType, "jetbrains.mps.lang.smodel.structure.SNodeListType")) {
     return _quotation_createNode_w9106s_a0a2a5(
         SLinkOperations.getTarget(
             SNodeOperations.cast(OutputType, "jetbrains.mps.lang.smodel.structure.SNodeListType"),
             "elementConcept",
             false));
   } else {
     SNode outputSNodeType =
         TypeChecker.getInstance()
             .getRuntimeSupport()
             .coerce_(
                 OutputType,
                 HUtil.createMatchingPatternByConceptFQName(
                     "jetbrains.mps.lang.smodel.structure.SNodeType"),
                 true);
     if (outputSNodeType != null) {
       return outputSNodeType;
     } else {
       SNode outputSequenceType =
           TypeChecker.getInstance()
               .getRuntimeSupport()
               .coerce_(
                   OutputType,
                   HUtil.createMatchingPatternByConceptFQName(
                       "jetbrains.mps.baseLanguage.collections.structure.SequenceType"),
                   true);
       if (outputSequenceType != null) {
         SNode elementType = SLinkOperations.getTarget(outputSequenceType, "elementType", true);
         SNode outputSNodeType2 =
             TypeChecker.getInstance()
                 .getRuntimeSupport()
                 .coerce_(
                     elementType,
                     HUtil.createMatchingPatternByConceptFQName(
                         "jetbrains.mps.lang.smodel.structure.SNodeType"),
                     true);
         if (outputSNodeType2 != null) {
           return outputSNodeType2;
         }
       }
     }
   }
   return _quotation_createNode_w9106s_a3a5();
 }
Example #10
0
 public static boolean static_canBeAChild(
     final IOperationContext operationContext, final CanBeAChildContext _context) {
   return TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           TypeChecker.getInstance()
               .getTypeOf(
                   SLinkOperations.getTarget(
                       SNodeOperations.as(
                           _context.getParentNode(),
                           "jetbrains.mps.baseLanguage.structure.DotExpression"),
                       "operand",
                       true)),
           new CallMethodOperation_Constraints.QuotationClass_j1qytb_a1a0a0a().createNode());
 }
Example #11
0
 public List<String> createAvailableTypes() {
   if (this.myType == null) {
     List<String> result = ListSequence.fromList(new ArrayList<String>());
     return result;
   }
   SubtypingManager manager = TypeChecker.getInstance().getSubtypingManager();
   StructuralNodeSet<?> frontier = new StructuralNodeSet();
   List<SNode> found = new ArrayList<SNode>();
   frontier.add(this.myType);
   while (!(frontier.isEmpty())) {
     StructuralNodeSet<?> ancestors = new StructuralNodeSet();
     for (SNode node : SetSequence.fromSet(frontier)) {
       ancestors.addAllStructurally(manager.collectImmediateSupertypes(node, false));
       ListSequence.fromList(found).addElement(node);
     }
     for (SNode passed : ListSequence.fromList(found)) {
       ancestors.removeStructurally(passed);
     }
     frontier = ancestors;
   }
   List<String> result = ListSequence.fromList(new ArrayList<String>());
   for (SNode node : ListSequence.fromList(found)) {
     ListSequence.fromList(result).addElement(node.toString());
     MapSequence.fromMap(this.myTypesMap).put(node.toString(), node);
   }
   return result;
 }
 public List<SNode> getSubOrSuperTypes(
     SNode listType, TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   List<SNode> result = new ArrayList<SNode>();
   SNode classifierType =
       TypeChecker.getInstance()
           .getRuntimeSupport()
           .coerce_(
               SLinkOperations.getTarget(listType, "elementType", true),
               HUtil.createMatchingPatternByConceptFQName(
                   "jetbrains.mps.baseLanguage.structure.ClassifierType"),
               true,
               typeCheckingContext);
   if (SLinkOperations.getTarget(classifierType, "classifier", false)
       == SLinkOperations.getTarget(
           new supertypesOf_ListType_ListType_elementSNode_SubtypingRule
                   .QuotationClass_84rynv_a0a0c0a()
               .createNode(typeCheckingContext),
           "classifier",
           false)) {
     ListSequence.fromList(result)
         .addElement(
             new supertypesOf_ListType_ListType_elementSNode_SubtypingRule
                     .QuotationClass_84rynv_a0a0a0c0a()
                 .createNode(typeCheckingContext));
   }
   return result;
 }
 @NonNls
 /*package*/ static String getSuffix_idO$iR4JBsSb(@NotNull SNode __thisNode__) {
   if ((SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getContainmentLink(
               0x22e72e4c0f6946ceL,
               0x84036750153aa615L,
               0x3c97fcb79c84cda6L,
               0x6552f0adf298f24fL,
               "source"))
       == null)) {
     return "";
   }
   return ((String)
       IGeneratedToClass__BehaviorDescriptor.getValidClassName_id2eOtvO7hJjT.invoke(
           __thisNode__,
           BaseConcept__BehaviorDescriptor.getPresentation_idhEwIMiw.invoke(
               SNodeOperations.cast(
                   TypeChecker.getInstance()
                       .getTypeOf(
                           SLinkOperations.getTarget(
                               __thisNode__,
                               MetaAdapterFactory.getContainmentLink(
                                   0x22e72e4c0f6946ceL,
                                   0x84036750153aa615L,
                                   0x3c97fcb79c84cda6L,
                                   0x6552f0adf298f24fL,
                                   "source"))),
                   MetaAdapterFactory.getConcept(
                       0xceab519525ea4f22L,
                       0x9b92103b95ca8c0cL,
                       0x10802efe25aL,
                       "jetbrains.mps.lang.core.structure.BaseConcept")))));
 }
Example #14
0
 @Nullable
 Pair<Boolean, SNode> getCoerceCacheAnswer(
     SNode subtype, IMatchingPattern pattern, boolean isWeak) {
   SubtypingCache cache = myTypeChecker.getSubtypingCache();
   if (cache != null) {
     Pair<Boolean, SNode> coerced = cache.getCoerced(subtype, pattern, isWeak);
     if (coerced != null) {
       return coerced;
     }
   }
   cache = myTypeChecker.getGlobalSubtypingCache();
   if (cache != null) {
     Pair<Boolean, SNode> coerced = cache.getCoerced(subtype, pattern, isWeak);
     if (coerced != null) return coerced;
   }
   return null;
 }
Example #15
0
 private static boolean isOverloading(
     SNode node, SNode leftType, SNode rightType, SNode operator) {
   if (!((TypeChecker.getInstance()
           .getSubtypingManager()
           .isSubtype(leftType, SLinkOperations.getTarget(operator, "leftType", true))
       && TypeChecker.getInstance()
           .getSubtypingManager()
           .isSubtype(rightType, SLinkOperations.getTarget(operator, "rightType", true))))) {
     return false;
   }
   if (SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(operator, "operator", true),
       "jetbrains.mps.baseLanguage.overloadedOperators.structure.BinaryOperationReference")) {
     if (SNodeOperations.isInstanceOf(
         node,
         NameUtil.nodeFQName(
             SLinkOperations.getTarget(
                 SNodeOperations.cast(
                     SLinkOperations.getTarget(operator, "operator", true),
                     "jetbrains.mps.baseLanguage.overloadedOperators.structure.BinaryOperationReference"),
                 "binaryOperation",
                 false)))) {
       return true;
     }
   } else if (SNodeOperations.isInstanceOf(
           SLinkOperations.getTarget(operator, "operator", true),
           "jetbrains.mps.baseLanguage.overloadedOperators.structure.CustomOperator")
       && SNodeOperations.isInstanceOf(
           node, "jetbrains.mps.baseLanguage.overloadedOperators.structure.CustomOperatorUsage")) {
     if (SLinkOperations.getTarget(
             SNodeOperations.cast(
                 node,
                 "jetbrains.mps.baseLanguage.overloadedOperators.structure.CustomOperatorUsage"),
             "operator",
             false)
         == SLinkOperations.getTarget(
             SNodeOperations.cast(
                 SLinkOperations.getTarget(operator, "operator", true),
                 "jetbrains.mps.baseLanguage.overloadedOperators.structure.CustomOperator"),
             "declaration",
             false)) {
       return true;
     }
   }
   return false;
 }
Example #16
0
 public static SNode getBinaryOperationType(SNode leftType, SNode rightType, boolean mayBeString) {
   List<SNode> leastCommonSupertypes =
       SubtypingUtil.leastCommonSuperTypes(Arrays.asList(leftType, rightType), null);
   if (mayBeString) {
     SModel javaLangJavaStubModelDescriptor =
         SModelRepository.getInstance()
             .getModelDescriptor(SModelReference.fromString("java.lang@java_stub"));
     assert javaLangJavaStubModelDescriptor != null;
     SModel javaLang = javaLangJavaStubModelDescriptor.getSModel();
     SNode stringClass = SModelOperations.getRootByName(javaLang, "String");
     if (SNodeOperations.isInstanceOf(
                 leftType, "jetbrains.mps.baseLanguage.structure.ClassifierType")
             && SLinkOperations.getTarget(
                     (SNodeOperations.cast(
                         leftType, "jetbrains.mps.baseLanguage.structure.ClassifierType")),
                     "classifier",
                     false)
                 == stringClass
         || SNodeOperations.isInstanceOf(
                 rightType, "jetbrains.mps.baseLanguage.structure.ClassifierType")
             && SLinkOperations.getTarget(
                     (SNodeOperations.cast(
                         rightType, "jetbrains.mps.baseLanguage.structure.ClassifierType")),
                     "classifier",
                     false)
                 == stringClass) {
       SNode classifierType =
           SConceptOperations.createNewNode(
               "jetbrains.mps.baseLanguage.structure.ClassifierType", null);
       SLinkOperations.setTarget(
           classifierType,
           "classifier",
           SNodeOperations.cast(stringClass, "jetbrains.mps.baseLanguage.structure.Classifier"),
           false);
       return classifierType;
     }
   }
   if (leastCommonSupertypes.isEmpty()) {
     SNode runtimeErrorType =
         SConceptOperations.createNewNode(
             "jetbrains.mps.lang.typesystem.structure.RuntimeErrorType", null);
     SPropertyOperations.set(runtimeErrorType, "errorText", "incompatible types");
     return runtimeErrorType;
   }
   SNode type = leastCommonSupertypes.iterator().next();
   {
     IMatchingPattern pattern_j6k1pf_e0c =
         HUtil.createMatchingPatternByConceptFQName(
             "jetbrains.mps.baseLanguage.structure.PrimitiveType");
     SNode coercedNode_j6k1pf_e0c =
         TypeChecker.getInstance().getRuntimeSupport().coerce_(type, pattern_j6k1pf_e0c);
     if (coercedNode_j6k1pf_e0c != null) {
       return coercedNode_j6k1pf_e0c;
     } else {
       return type;
     }
   }
 }
 public static boolean static_canBeAChild(
     SNode node,
     SNode parentNode,
     SNode link,
     SNode childConcept,
     final IOperationContext operationContext) {
   return TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           TypeChecker.getInstance()
               .getTypeOf(
                   SNodeOperations.getAncestor(
                       parentNode,
                       "jetbrains.mps.lang.plugin.structure.ActionDataParameterDeclaration",
                       true,
                       false)),
           _quotation_createNode_y4qgg5_b0a0a0());
 }
 private boolean isApplicableToNode(final SNode node, final EditorContext editorContext) {
   return (TypeChecker.getInstance()
           .getRuntimeSupport()
           .coerce_(
               TypeChecker.getInstance()
                   .getTypeOf(
                       SLinkOperations.getTarget(
                           node,
                           MetaAdapterFactory.getContainmentLink(
                               0xf3061a5392264cc5L,
                               0xa443f952ceaf5816L,
                               0xf8cc56b213L,
                               0xf8cc56b214L,
                               "expression"))),
               new IterateOverIterable_Intention.Pattern_w1n2qe_a1a0a0a0e(),
               true)
       != null);
 }
 public static boolean static_canBeAChild(
     SNode node,
     SNode parentNode,
     SNode link,
     SNode childConcept,
     final IOperationContext operationContext) {
   return (SNodeOperations.getNodeAncestor(
               parentNode,
               MetaAdapterFactory.getConcept(
                   0x756e911c3f1f4a48L,
                   0xbdf5a2ceb91b723cL,
                   0xd244b712f91012dL,
                   "jetbrains.mps.execution.settings.structure.EditorOperationDeclaration"),
               true,
               false)
           == null)
       && (TypeChecker.getInstance()
               .getRuntimeSupport()
               .coerce_(
                   TypeChecker.getInstance()
                       .getTypeOf(
                           SLinkOperations.getTarget(
                               SNodeOperations.as(
                                   parentNode,
                                   MetaAdapterFactory.getConcept(
                                       0xf3061a5392264cc5L,
                                       0xa443f952ceaf5816L,
                                       0x116b46a08c4L,
                                       "jetbrains.mps.baseLanguage.structure.DotExpression")),
                               MetaAdapterFactory.getContainmentLink(
                                   0xf3061a5392264cc5L,
                                   0xa443f952ceaf5816L,
                                   0x116b46a08c4L,
                                   0x116b46a4416L,
                                   "operand"))),
                   HUtil.createMatchingPatternByConcept(
                       MetaAdapterFactory.getConcept(
                           0x756e911c3f1f4a48L,
                           0xbdf5a2ceb91b723cL,
                           0xd244b712f91001cL,
                           "jetbrains.mps.execution.settings.structure.PersistentConfigurationType")),
                   true)
           != null);
 }
Example #20
0
 public static SNode sourceNodeQuery_1758784108619328008(
     final IOperationContext operationContext, final SourceSubstituteMacroNodeContext _context) {
   return ClassifierTypeUtil.getTypeCoercedToClassifierType(
       SNodeOperations.copyNode(
           TypeChecker.getInstance()
               .getTypeOf(
                   SNodeOperations.getParent(
                       IOperation_Behavior.call_getDotExpression_1224687669172(
                           _context.getNode())))));
 }
 public void applyRule(
     final SNode nodeToCheck,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode operandType =
       TypeChecker.getInstance()
           .getTypeOf(IOperation_BehaviorDescriptor.getOperand_idhEwIP$m.invoke(nodeToCheck));
   {
     IMatchingPattern pattern_hm5x7h_b0 =
         HUtil.createMatchingPatternByConceptFQName(
             "jetbrains.mps.baseLanguage.classifiers.structure.BaseClassifierType");
     SNode coercedNode_hm5x7h_b0 =
         TypeChecker.getInstance().getRuntimeSupport().coerce_(operandType, pattern_hm5x7h_b0);
     if (coercedNode_hm5x7h_b0 != null) {
       if (!(ListSequence.fromList(
               BaseClassifierType_BehaviorDescriptor.getMembers_idhEwINC$.invoke(
                   coercedNode_hm5x7h_b0, nodeToCheck))
           .contains(
               SLinkOperations.getTarget(
                   nodeToCheck,
                   MetaAdapterFactory.getReferenceLink(
                       0x443f4c36fcf54eb6L,
                       0x95008d06ed259e3eL,
                       0x118bca97396L,
                       0x118bcb657ecL,
                       "member"))))) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   nodeToCheck,
                   "Declaration is out of scope",
                   "r:00000000-0000-4000-0000-011c89590371(jetbrains.mps.baseLanguage.classifiers.typesystem)",
                   "1205921883388",
                   null,
                   errorTarget);
         }
       }
     } else {
     }
   }
 }
Example #22
0
 @Deprecated
 private static boolean staticCanBeAChild_Old(
     SNode node,
     SNode parentNode,
     SNode link,
     SNode childConcept,
     final IOperationContext operationContext) {
   return SNodeOperations.isInstanceOf(
           parentNode,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x116b46a08c4L,
               "jetbrains.mps.baseLanguage.structure.DotExpression"))
       && TypeChecker.getInstance()
               .getRuntimeSupport()
               .coerce_(
                   TypeChecker.getInstance()
                       .getTypeOf(
                           SLinkOperations.getTarget(
                               SNodeOperations.cast(
                                   parentNode,
                                   MetaAdapterFactory.getConcept(
                                       0xf3061a5392264cc5L,
                                       0xa443f952ceaf5816L,
                                       0x116b46a08c4L,
                                       "jetbrains.mps.baseLanguage.structure.DotExpression")),
                               MetaAdapterFactory.getContainmentLink(
                                   0xf3061a5392264cc5L,
                                   0xa443f952ceaf5816L,
                                   0x116b46a08c4L,
                                   0x116b46a4416L,
                                   "operand"))),
                   HUtil.createMatchingPatternByConcept(
                       MetaAdapterFactory.getConcept(
                           0x662a9f2b58024d16L,
                           0x955872c65c7a681eL,
                           0x4b9a2fe55913516aL,
                           "org.jetbrains.mps.samples.Money.structure.MoneyType")),
                   true)
           != null;
 }
 public boolean isApplicableCustom(SNode subtype, SNode supertype, IsApplicable2Status status) {
   return !(SNodeOperations.isInstanceOf(
           supertype, "jetbrains.mps.baseLanguage.structure.PrimitiveType")
       || TypeChecker.getInstance()
           .getSubtypingManager()
           .isSubtype(
               supertype,
               SLinkOperations.getTarget(
                   _quotation_createNode_fu2yto_a1a0a0a0a(), "descriptor", false),
               false));
 }
Example #24
0
 private boolean checkParameter(SNode parameter) {
   List<SNode> nodes = MapSequence.fromMap(this.myParamsToNodes).get(parameter);
   if ((int) ListSequence.fromList(nodes).count() == 0) {
     return true;
   }
   for (int i = 0; i < ListSequence.fromList(nodes).count() - 1; i++) {
     if (!(MatchingUtil.matchNodes(
         ListSequence.fromList(nodes).getElement(i),
         ListSequence.fromList(nodes).getElement(i + 1)))) {
       return false;
     }
   }
   if (!(TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(
           TypeChecker.getInstance().getTypeOf(ListSequence.fromList(nodes).getElement(0)),
           SLinkOperations.getTarget(parameter, "type", true)))) {
     return false;
   }
   return true;
 }
 public static boolean static_canBeAChild(
     SNode node,
     SNode parentNode,
     SNode link,
     SNode childConcept,
     final IOperationContext operationContext) {
   return (TypeChecker.getInstance()
           .getRuntimeSupport()
           .coerce_(
               TypeChecker.getInstance()
                   .getTypeOf(
                       SLinkOperations.getTarget(
                           SNodeOperations.as(
                               parentNode, "jetbrains.mps.baseLanguage.structure.DotExpression"),
                           "operand",
                           true)),
               HUtil.createMatchingPatternByConceptFQName(
                   "jetbrains.mps.baseLanguage.collections.structure.MappingType"),
               false)
       != null);
 }
Example #26
0
 public static boolean virtual_isSupersetOf_1220438914705(SNode thisNode, SNode t) {
   {
     GeneratedMatchingPattern pattern_smb55n_a0o =
         new Type_Behavior.Pattern_smb55n_a0a0a0a51(thisNode);
     SNode coercedNode_smb55n_a0o =
         TypeChecker.getInstance().getRuntimeSupport().coerce_(t, pattern_smb55n_a0o);
     if (coercedNode_smb55n_a0o != null) {
       return true;
     } else {
     }
   }
   return false;
 }
Example #27
0
 public static boolean baseMappingRule_Condition_3100399657864717070(
     final IOperationContext operationContext, final BaseMappingRuleContext _context) {
   Iterable<SNode> operators =
       ListSequence.fromList(
               SModelOperations.getRootsIncludingImported(
                   _context.getOriginalInputModel(),
                   _context.getScope(),
                   "jetbrains.mps.baseLanguage.overloadedOperators.structure.OverloadedOperatorContainer"))
           .translate(
               new ITranslator2<SNode, SNode>() {
                 public Iterable<SNode> translate(SNode it) {
                   return SLinkOperations.getTargets(it, "operators", true);
                 }
               });
   return BinaryOperationUtil.hasOverloadedOperators(
       _context.getNode(),
       TypeChecker.getInstance()
           .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "leftExpression", true)),
       TypeChecker.getInstance()
           .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "rightExpression", true)),
       Sequence.fromIterable(operators).toListSequence());
 }
Example #28
0
 public static SNode virtual_getJavaType_1213877337345(SNode thisNode) {
   return TypeChecker.getInstance()
       .getRuntimeSupport()
       .coerce_(
           thisNode,
           HUtil.createMatchingPatternByConcept(
               MetaAdapterFactory.getConcept(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   "jetbrains.mps.baseLanguage.structure.ClassifierType")),
           true);
 }
Example #29
0
 public static Object propertyMacro_GetPropertyValue_3524394717035465440(
     final IOperationContext operationContext, final PropertyMacroContext _context) {
   SNode op =
       BinaryOperationUtil.getNearestOverloaded(
           _context.getNode(),
           TypeChecker.getInstance()
               .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "leftExpression", true)),
           TypeChecker.getInstance()
               .getTypeOf(SLinkOperations.getTarget(_context.getNode(), "rightExpression", true)),
           ListSequence.fromList(
                   SModelOperations.getRootsIncludingImported(
                       SNodeOperations.getModel(_context.getNode()),
                       _context.getScope(),
                       "jetbrains.mps.baseLanguage.overloadedOperators.structure.OverloadedOperatorContainer"))
               .translate(
                   new ITranslator2<SNode, SNode>() {
                     public Iterable<SNode> translate(SNode it) {
                       return SLinkOperations.getTargets(it, "operators", true);
                     }
                   })
               .toListSequence());
   return OverloadedBinaryOperator_Behavior.call_getFunctionName_6677452554240637506(op);
 }
  @Override
  public SNode getActionType(String pattern) {
    SNode node = createChildNode(getParameterObject(), null, pattern);
    if (ActionsUtil.isInstanceOfIType(node)) return node;

    // the following is for smart-type completion

    AbstractNodeSubstituteInfo.getModelForTypechecking().addRootNode(node);
    try {
      return TypeChecker.getInstance().getTypeOf(node);
    } finally {
      AbstractNodeSubstituteInfo.getModelForTypechecking().removeRootNode(node);
    }
  }