コード例 #1
0
 public static SNode call_getReferentConcept_1213877261403(SNode thisNode) {
   if ((SNodeOperations.getAncestor(
           thisNode, "jetbrains.mps.lang.behavior.structure.ConceptBehavior", false, false)
       != null)) {
     return SLinkOperations.getTarget(
         SNodeOperations.cast(
             SNodeOperations.getContainingRoot(thisNode),
             "jetbrains.mps.lang.behavior.structure.ConceptBehavior"),
         "concept",
         false);
   }
   if ((SNodeOperations.getAncestor(
           thisNode, "jetbrains.mps.lang.constraints.structure.ConceptConstraints", false, false)
       != null)) {
     return SLinkOperations.getTarget(
         SNodeOperations.getAncestor(
             thisNode,
             "jetbrains.mps.lang.constraints.structure.ConceptConstraints",
             false,
             false),
         "concept",
         false);
   }
   return null;
 }
コード例 #2
0
 public void execute(final SNode node, final EditorContext editorContext) {
   // produce throw statement
   SNode throwStatement =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.ThrowStatement", null);
   SNode newExpr = _quotation_createNode_a1x6vi_a0c0a();
   SLinkOperations.setTarget(throwStatement, "throwable", newExpr, true);
   // produce if statement
   SNode ifStatement =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.IfStatement", null);
   SNode notExpr =
       SNodeFactoryOperations.setNewChild(
           ifStatement, "condition", "jetbrains.mps.baseLanguage.structure.NotExpression");
   SLinkOperations.setTarget(
       notExpr, "expression", SLinkOperations.getTarget(node, "condition", true), true);
   SNodeFactoryOperations.setNewChild(
       ifStatement, "ifTrue", "jetbrains.mps.baseLanguage.structure.StatementList");
   ListSequence.fromList(
           SLinkOperations.getTargets(
               SLinkOperations.getTarget(ifStatement, "ifTrue", true), "statement", true))
       .insertElement(0, throwStatement);
   // replace assert with if
   SNodeOperations.replaceWithAnother(node, ifStatement);
 }
    public void execute(final SNode node, final EditorContext editorContext) {
      SNode templateNode =
          SNodeFactoryOperations.createNewRootNode(
              SNodeOperations.getModel(node),
              "jetbrains.mps.lang.generator.structure.TemplateDeclaration",
              null);
      SNode ruleNode =
          SNodeOperations.getAncestor(
              node, "jetbrains.mps.lang.generator.structure.BaseMappingRule", false, false);
      SLinkOperations.setTarget(
          templateNode,
          "applicableConcept",
          SLinkOperations.getTarget(ruleNode, "applicableConcept", false),
          false);
      SPropertyOperations.set(templateNode, "name", "template1");
      SLinkOperations.setTarget(
          templateNode, "contentNode", SLinkOperations.getTarget(node, "templateNode", true), true);
      SPropertyOperations.set(
          templateNode,
          "virtualPackage",
          SPropertyOperations.getString(SNodeOperations.getContainingRoot(node), "virtualPackage"));

      SNode templateRefNode =
          SNodeFactoryOperations.replaceWithNewChild(
              node, "jetbrains.mps.lang.generator.structure.TemplateDeclarationReference");
      SLinkOperations.setTarget(templateRefNode, "template", templateNode, false);

      SelectionUtil.selectNode(editorContext, templateNode);
    }
コード例 #4
0
 public void execute(SNode node) {
   if ((boolean)
       Expression__BehaviorDescriptor.singleValue_id1o8Ht9sES3u.invoke(
           SNodeOperations.asSConcept(
               SNodeOperations.getConceptDeclaration(
                   SLinkOperations.getTarget(
                       ((SNode)
                           RemoveUnnecessaryParentheses_QuickFix.this
                               .getField("bottomLineParens")[0]),
                       MetaAdapterFactory.getContainmentLink(
                           0xf3061a5392264cc5L,
                           0xa443f952ceaf5816L,
                           0xfb4ed32b7fL,
                           0xfb4ed32b80L,
                           "expression")))))) {
     SNodeOperations.replaceWithAnother(
         node,
         SLinkOperations.getTarget(
             ((SNode) RemoveUnnecessaryParentheses_QuickFix.this.getField("bottomLineParens")[0]),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0xfb4ed32b7fL,
                 0xfb4ed32b80L,
                 "expression")));
   }
   SNodeOperations.replaceWithAnother(
       node, ((SNode) RemoveUnnecessaryParentheses_QuickFix.this.getField("bottomLineParens")[0]));
 }
コード例 #5
0
ファイル: QueriesGenerated.java プロジェクト: TonyRietwyk/MPS
 public static void nodeFactory_NodeSetup_CoerceExpression_1178879020941(
     final IOperationContext operationContext, final NodeSetupContext _context) {
   if (SNodeOperations.isInstanceOf(
       _context.getSampleNode(), "jetbrains.mps.lang.typesystem.structure.CoerceExpression")) {
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "nodeToCoerce",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.CoerceExpression"),
             "nodeToCoerce",
             true),
         true);
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "pattern",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.CoerceExpression"),
             "pattern",
             true),
         true);
   }
 }
コード例 #6
0
 public static boolean virtual_isMpsStartRequired_3310779261129403089(SNode thisNode) {
   for (SNode annotationInstance :
       ListSequence.fromList(SLinkOperations.getTargets(thisNode, "annotation", true))) {
     if (SLinkOperations.getTarget(annotationInstance, "annotation", false)
         .equals(
             SNodeOperations.getNode(
                 "f:java_stub#920eaa0e-ecca-46bc-bee7-4e5c59213dd6#jetbrains.mps(Testbench/jetbrains.mps@java_stub)",
                 "~MPSLaunch"))) {
       return true;
     }
   }
   for (SNode method :
       SLinkOperations.getTargets(
           SLinkOperations.getTarget(thisNode, "testMethodList", true), "testMethod", true)) {
     for (SNode annotationInstance : SLinkOperations.getTargets(method, "annotation", true)) {
       if (SLinkOperations.getTarget(annotationInstance, "annotation", false)
           .equals(
               SNodeOperations.getNode(
                   "f:java_stub#920eaa0e-ecca-46bc-bee7-4e5c59213dd6#jetbrains.mps(Testbench/jetbrains.mps@java_stub)",
                   "~MPSLaunch"))) {
         return true;
       }
     }
   }
   return false;
 }
コード例 #7
0
 public static boolean call_isParameterOfThisMethod_1240394425603(SNode thisNode) {
   // todo: method from ParameterReference. Remove.
   if (!(SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(thisNode, "variableDeclaration", false),
       "jetbrains.mps.baseLanguage.structure.ParameterDeclaration"))) {
     throw new IllegalArgumentException();
   }
   if (SNodeOperations.getAncestor(
           thisNode, "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration", false, false)
       == SNodeOperations.getAncestor(
           SLinkOperations.getTarget(thisNode, "variableDeclaration", false),
           "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration",
           false,
           false)) {
     if (SNodeOperations.getAncestor(
             thisNode, "jetbrains.mps.baseLanguage.structure.Closureoid", false, false)
         == SNodeOperations.getAncestor(
             SLinkOperations.getTarget(thisNode, "variableDeclaration", false),
             "jetbrains.mps.baseLanguage.structure.Closureoid",
             false,
             false)) {
       return true;
     }
   }
   return false;
 }
 public void applyRule(
     final SNode variableReference,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(variableReference, "variableDeclaration", false),
       "jetbrains.mps.baseLanguage.structure.ParameterDeclaration")) {
     SNode declaration =
         SNodeOperations.cast(
             SLinkOperations.getTarget(variableReference, "variableDeclaration", false),
             "jetbrains.mps.baseLanguage.structure.ParameterDeclaration");
     if ((declaration != null) && !(SPropertyOperations.getBoolean(declaration, "isFinal"))) {
       if (!(VariableReference_Behavior.call_isParameterOfThisMethod_1240394425603(
           variableReference))) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   variableReference,
                   "Parameter must be final",
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1240395578471",
                   null,
                   errorTarget);
         }
       }
     }
   }
 }
コード例 #9
0
 public static boolean call_isRoot_8969040284892403078(SNode __thisNode__) {
   return SPropertyOperations.getBoolean(
           __thisNode__,
           MetaAdapterFactory.getProperty(
               0x132aa4d8a3f7441cL,
               0xa7eb3fce23492c6aL,
               0x6524536b2e1a1e38L,
               0x6524536b2e1bddd7L,
               "root"))
       || (SLinkOperations.getTarget(
                   __thisNode__,
                   MetaAdapterFactory.getReferenceLink(
                       0x132aa4d8a3f7441cL,
                       0xa7eb3fce23492c6aL,
                       0x6524536b2e1a1e38L,
                       0x34f5c07463da7435L,
                       "extends"))
               != null)
           && SimpleBuilderDeclaration_BehaviorDescriptor.isRoot_id7LSrDTXbxm6.invoke(
               SLinkOperations.getTarget(
                   __thisNode__,
                   MetaAdapterFactory.getReferenceLink(
                       0x132aa4d8a3f7441cL,
                       0xa7eb3fce23492c6aL,
                       0x6524536b2e1a1e38L,
                       0x34f5c07463da7435L,
                       "extends")));
 }
コード例 #10
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);
 }
コード例 #11
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[] {});
 }
コード例 #12
0
 public void doGenerateText(SNode node) {
   this.append("@ECHO OFF");
   this.appendNewLine();
   this.append("SETLOCAL ENABLEDELAYEDEXPANSION");
   this.appendNewLine();
   this.append("REM ");
   this.append(SPropertyOperations.getString(node, "name"));
   this.appendNewLine();
   this.append("REM ");
   this.append(SPropertyOperations.getString(node, "description"));
   this.appendNewLine();
   this.appendNewLine();
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "code", true),
           this.getSNode());
   this.appendNewLine();
   this.appendNewLine();
   this.append("GOTO :EOF");
   this.appendNewLine();
   TextGenManager.instance()
       .appendNodeText(
           this.getContext(),
           this.getBuffer(),
           SLinkOperations.getTarget(node, "functions", true),
           this.getSNode());
 }
コード例 #13
0
ファイル: QueriesGenerated.java プロジェクト: wolfhesse/MPS
 public static Object propertyMacro_GetPropertyValue_2968360207536878977(
     final IOperationContext operationContext, final PropertyMacroContext _context) {
   return ((SLinkOperations.getTarget(_context.getNode(), "path", true) != null)
       ? SPropertyOperations.getString(
           SLinkOperations.getTarget(_context.getNode(), "path", true), "value")
       : "");
 }
コード例 #14
0
 private static SReference getCheckingReference_id4IvydoGvimX(@NotNull SNode __thisNode__) {
   if (SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getReferenceLink(
               0x8585453e6bfb4d80L,
               0x98deb16074f1d86cL,
               0x7181d929c720809L,
               0x4b9f88d62c795596L,
               "checkingReference"))
       == null) {
     return ((SNode) SNodeOperations.getParent(__thisNode__)).getReferences().iterator().next();
   }
   for (SReference reference :
       Sequence.fromIterable(
           SNodeOperations.getReferences(SNodeOperations.getParent(__thisNode__)))) {
     if (SLinkOperations.getTargetNode(reference)
         == SLinkOperations.getTarget(
             __thisNode__,
             MetaAdapterFactory.getReferenceLink(
                 0x8585453e6bfb4d80L,
                 0x98deb16074f1d86cL,
                 0x7181d929c720809L,
                 0x4b9f88d62c795596L,
                 "checkingReference"))) {
       return (jetbrains.mps.smodel.SReference) reference;
     }
   }
   return null;
 }
コード例 #15
0
 public void build(
     final IOperationContext operationContext, final DataFlowBuilderContext _context) {
   _context
       .getBuilder()
       .build(
           (SNode)
               SLinkOperations.getTarget(
                   _context.getNode(),
                   MetaAdapterFactory.getContainmentLink(
                       0xf61473f9130f42f6L,
                       0xb98d6c438812c2f6L,
                       0x74f562a3a993fd3dL,
                       0x74f562a3a993fd44L,
                       "expected")));
   _context
       .getBuilder()
       .build(
           (SNode)
               SLinkOperations.getTarget(
                   _context.getNode(),
                   MetaAdapterFactory.getContainmentLink(
                       0xf61473f9130f42f6L,
                       0xb98d6c438812c2f6L,
                       0x74f562a3a993fd3dL,
                       0x74f562a3a993fd45L,
                       "actual")));
 }
コード例 #16
0
  public static SNode virtual_getAttachStatementChild_4797501453850305563(
      SNode thisNode, SNode parentBuilder, SNode parentRef, SNode childRef) {

    SNode result =
        SNodeOperations.copyNode(
            SLinkOperations.getTarget(
                SLinkOperations.getTarget(thisNode, "declaration", false), "set", true));
    for (SNode p :
        SNodeOperations.getDescendants(
            result,
            "jetbrains.mps.baseLanguage.builders.structure.SimpleBuilderPropertyParent",
            false,
            new String[] {})) {
      SNodeOperations.replaceWithAnother(p, SNodeOperations.copyNode(parentRef));
    }
    for (SNode v :
        SNodeOperations.getDescendants(
            result,
            "jetbrains.mps.baseLanguage.builders.structure.SimpleBuilderPropertyValue",
            false,
            new String[] {})) {
      SNodeOperations.replaceWithAnother(v, SNodeOperations.copyNode(childRef));
    }
    return result;
  }
コード例 #17
0
 private boolean nodeCondition_d5p1uc_a2a() {
   return (SLinkOperations.getTarget(
               myNode,
               MetaAdapterFactory.getReferenceLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x114a6b4ccabL,
                   0x114a6b85d40L,
                   "annotation"))
           != null)
       && ListSequence.fromList(
               SLinkOperations.getChildren(
                   SLinkOperations.getTarget(
                       myNode,
                       MetaAdapterFactory.getReferenceLink(
                           0xf3061a5392264cc5L,
                           0xa443f952ceaf5816L,
                           0x114a6b4ccabL,
                           0x114a6b85d40L,
                           "annotation")),
                   MetaAdapterFactory.getContainmentLink(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x101d9d3ca30L,
                       0x101f2cc410bL,
                       "method")))
           .isNotEmpty();
 }
コード例 #18
0
ファイル: QueriesGenerated.java プロジェクト: handong890/MPS
 public static boolean baseMappingRule_Condition_1217891542034(
     final BaseMappingRuleContext _context) {
   return SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(
           SNodeOperations.as(
               SLinkOperations.getTarget(
                   _context.getNode(),
                   MetaAdapterFactory.getContainmentLink(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x11b0d00332cL,
                       0xf8c77f1e97L,
                       "lValue")),
               MetaAdapterFactory.getConcept(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x116b46a08c4L,
                   "jetbrains.mps.baseLanguage.structure.DotExpression")),
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x116b46a08c4L,
               0x116b46b36c4L,
               "operation")),
       MetaAdapterFactory.getConcept(
           0xd7706f639be2479cL,
           0xa3daae92af1e64d5L,
           0x11b8fe60348L,
           "jetbrains.mps.lang.generator.generationContext.structure.GenerationContextOp_UserObjectAccessBase"));
 }
コード例 #19
0
 public static List<SNode> virtual_getTestMethods_2148145109766218395(SNode thisNode) {
   List<SNode> result = new ArrayList<SNode>();
   if (!(SPropertyOperations.getBoolean(thisNode, "abstractClass"))) {
     ListSequence.fromList(result)
         .addSequence(
             ListSequence.fromList(
                 SLinkOperations.getTargets(
                     SLinkOperations.getTarget(thisNode, "testMethodList", true),
                     "testMethod",
                     true)));
     if (SNodeOperations.isInstanceOf(
         SLinkOperations.getTarget(
             SLinkOperations.getTarget(thisNode, "superclass", true), "classifier", false),
         "jetbrains.mps.baseLanguage.unitTest.structure.ITestCase")) {
       ListSequence.fromList(result)
           .addSequence(
               ListSequence.fromList(
                   BehaviorReflection.invokeVirtual(
                       (Class<List<SNode>>) ((Class) Object.class),
                       SNodeOperations.cast(
                           SLinkOperations.getTarget(
                               SLinkOperations.getTarget(thisNode, "superclass", true),
                               "classifier",
                               false),
                           "jetbrains.mps.baseLanguage.unitTest.structure.ITestCase"),
                       "virtual_getTestMethods_2148145109766218395",
                       new Object[] {})));
     }
   }
   return result;
 }
 public void applyRule(
     final SNode efr, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   {
     SNode _nodeToCheck_1029348928467 = efr;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:4b1ddbe6-5067-4a27-8697-eb786b50451b(jetbrains.mps.lang.extension.typesystem)",
             "7036359038356115138",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:4b1ddbe6-5067-4a27-8697-eb786b50451b(jetbrains.mps.lang.extension.typesystem)",
                 "7036359038356115126",
                 true),
         (SNode)
             SLinkOperations.getTarget(
                 SLinkOperations.getTarget(efr, "declaration", false), "fieldType", true),
         _info_12389875345);
   }
 }
コード例 #21
0
 public static boolean call_isVariableDefinedInThisMethod_1225456272518(SNode thisNode) {
   // todo: method from LocalVariableReference. Remove
   if (!(SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(thisNode, "variableDeclaration", false),
       "jetbrains.mps.baseLanguage.structure.LocalVariableDeclaration"))) {
     throw new IllegalArgumentException();
   }
   SNode anchor = thisNode;
   if ((SNodeOperations.getAncestor(
           thisNode, "jetbrains.mps.lang.quotation.structure.AbstractAntiquotation", false, false)
       != null)) {
     anchor =
         SNodeOperations.getAncestor(
             thisNode, "jetbrains.mps.lang.quotation.structure.Quotation", false, false);
   }
   if (SNodeOperations.getAncestor(
           anchor, "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration", false, false)
       == SNodeOperations.getAncestor(
           SLinkOperations.getTarget(thisNode, "variableDeclaration", false),
           "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration",
           false,
           false)) {
     if (SNodeOperations.getAncestor(
             anchor, "jetbrains.mps.baseLanguage.structure.Closureoid", false, false)
         == SNodeOperations.getAncestor(
             SLinkOperations.getTarget(thisNode, "variableDeclaration", false),
             "jetbrains.mps.baseLanguage.structure.Closureoid",
             false,
             false)) {
       return true;
     }
   }
   return false;
 }
  private static SNode getDependencyTarget_id4RsV8qJH_ED(
      @NotNull SNode __thisNode__, VisibleArtifacts artifacts) {
    if (SNodeOperations.getContainingRoot(__thisNode__)
        == SNodeOperations.getContainingRoot(
            SLinkOperations.getTarget(
                __thisNode__,
                MetaAdapterFactory.getReferenceLink(
                    0x798100da4f0a421aL,
                    0xb99171f8c50ce5d2L,
                    0x4ddcec86afb65a3fL,
                    0x4ddcec86afb65a40L,
                    "folder")))) {
      return null;
    }

    return JavaExportUtil.requireJarFolder(
        artifacts,
        SLinkOperations.getTarget(
            __thisNode__,
            MetaAdapterFactory.getReferenceLink(
                0x798100da4f0a421aL,
                0xb99171f8c50ce5d2L,
                0x4ddcec86afb65a3fL,
                0x4ddcec86afb65a40L,
                "folder")),
        __thisNode__);
  }
コード例 #23
0
ファイル: QueriesGenerated.java プロジェクト: TonyRietwyk/MPS
 public static void nodeFactory_NodeSetup_IsSubtypeExpression_1177408248540(
     final IOperationContext operationContext, final NodeSetupContext _context) {
   if (SNodeOperations.isInstanceOf(
       _context.getSampleNode(), "jetbrains.mps.lang.typesystem.structure.IsSubtypeExpression")) {
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "subtypeExpression",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.IsSubtypeExpression"),
             "subtypeExpression",
             true),
         true);
     SLinkOperations.setTarget(
         _context.getNewNode(),
         "supertypeExpression",
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 _context.getSampleNode(),
                 "jetbrains.mps.lang.typesystem.structure.IsSubtypeExpression"),
             "supertypeExpression",
             true),
         true);
   }
 }
 public void applyRule(
     final SNode op, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   {
     SNode _nodeToCheck_1029348928467 = op;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c895902f1(jetbrains.mps.lang.generator.generationContext.typesystem)",
             "1216860931325",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c895902f1(jetbrains.mps.lang.generator.generationContext.typesystem)",
                 "1216860931336",
                 true),
         (SNode)
             _quotation_createNode_tgcadk_a0a0b(
                 SLinkOperations.getTarget(
                     SLinkOperations.getTarget(op, "label", false), "targetConcept", false)),
         _info_12389875345);
   }
 }
 public void applyRule(
     final SNode annotationInstance,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode annotation = SLinkOperations.getTarget(annotationInstance, "annotation", false);
   for (SNode annotationMethod : SLinkOperations.getTargets(annotation, "method", true)) {
     if ((SLinkOperations.getTarget(annotationMethod, "defaultValue", true) != null)) {
       continue;
     }
     boolean found = false;
     for (SNode annotationInstanceValue :
         SLinkOperations.getTargets(annotationInstance, "value", true)) {
       if (SLinkOperations.getTarget(annotationInstanceValue, "key", false) == annotationMethod) {
         found = true;
         break;
       }
     }
     if (!(found)) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 annotationInstance,
                 "'"
                     + SPropertyOperations.getString(annotationMethod, "name")
                     + "' missing though required",
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "6624237184121162632",
                 null,
                 errorTarget);
       }
     }
   }
 }
コード例 #26
0
ファイル: QueriesGenerated.java プロジェクト: yan96in/MPS
 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());
 }
コード例 #27
0
ファイル: SimpleBuilder_Behavior.java プロジェクト: sprig/MPS
  public static SNode virtual_getCreatorExpression_7057666463730727863(
      SNode thisNode, SNode parentRef) {
    SNode result =
        SNodeOperations.copyNode(
            SLinkOperations.getTarget(
                SLinkOperations.getTarget(thisNode, "declaration", false), "creator", true));

    List<SNode> params =
        SLinkOperations.getTargets(
            SLinkOperations.getTarget(thisNode, "declaration", false), "parameter", true);
    List<SNode> args = SLinkOperations.getTargets(thisNode, "argument", true);
    if (ListSequence.fromList(params).count() != ListSequence.fromList(args).count()) {
      throw new RuntimeException();
    }

    for (SNode ref :
        SNodeOperations.getDescendants(
            result,
            "jetbrains.mps.baseLanguage.builders.structure.SimpleBuilderParameterReference",
            false,
            new String[] {})) {
      int index =
          ListSequence.fromList(params).indexOf(SLinkOperations.getTarget(ref, "parameter", false));
      SNodeOperations.replaceWithAnother(
          ref, SNodeOperations.copyNode(ListSequence.fromList(args).getElement(index)));
    }

    return result;
  }
コード例 #28
0
 private String getNodeName(SNode node, boolean isLast)
     throws ArtifactsRelativePathHelper.RelativePathException {
   if (SNodeOperations.isInstanceOf(node, "jetbrains.mps.build.structure.BuildLayout_Folder")) {
     return getBSName(
         SLinkOperations.getTarget(
             SNodeOperations.cast(node, "jetbrains.mps.build.structure.BuildLayout_Folder"),
             "containerName",
             true));
   } else if (SNodeOperations.isInstanceOf(node, "jetbrains.mps.build.structure.BuildLayout_Copy")
       && isLast) {
     SNode fileset =
         SLinkOperations.getTarget(
             SNodeOperations.cast(node, "jetbrains.mps.build.structure.BuildLayout_Copy"),
             "fileset",
             true);
     if (SNodeOperations.isInstanceOf(
         fileset, "jetbrains.mps.build.structure.BuildInputSingleFile")) {
       return BuildSourcePath_Behavior.call_getLastSegment_1368030936106771141(
           SLinkOperations.getTarget(
               SNodeOperations.cast(fileset, "jetbrains.mps.build.structure.BuildInputSingleFile"),
               "path",
               true),
           null);
     } else {
       throw new ArtifactsRelativePathHelper.RelativePathException(
           "cannot build relative path for copy, fileset is " + node.getConceptShortName());
     }
   }
   throw new ArtifactsRelativePathHelper.RelativePathException(
       "cannot build relative path for " + node.getConceptShortName());
 }
コード例 #29
0
 /*package*/ static Money getCurrentPrice_id3u6SZi0yq4L(@NotNull SNode __thisNode__) {
   if ((SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getContainmentLink(
               0x662a9f2b58024d16L,
               0x955872c65c7a681eL,
               0x3786e3f4808999c3L,
               0x3786e3f480b0926aL,
               "symbol"))
       == null)) {
     return new Money(BigDecimal.ZERO, "USD");
   }
   Money currentPrice =
       StockPriceDownloader.getInstance()
           .getCurrentPrice(
               SPropertyOperations.getString(
                   SLinkOperations.getTarget(
                       __thisNode__,
                       MetaAdapterFactory.getContainmentLink(
                           0x662a9f2b58024d16L,
                           0x955872c65c7a681eL,
                           0x3786e3f4808999c3L,
                           0x3786e3f480b0926aL,
                           "symbol")),
                   MetaAdapterFactory.getProperty(
                       0x662a9f2b58024d16L,
                       0x955872c65c7a681eL,
                       0x3786e3f480a9b18aL,
                       0x3786e3f480afac5bL,
                       "symbol")));
   if (currentPrice == null) {
     return new Money(BigDecimal.ZERO, "USD");
   }
   return currentPrice;
 }
コード例 #30
0
 public static List<SNode> virtual_getExtendedClassifierTypes_2201875424516179426(SNode thisNode) {
   List<SNode> extendsClassifiers = new ArrayList<SNode>();
   if (!(Classifier_Behavior.call_isSame_4855996797771684010(
       SNodeOperations.getNode(
           "f:java_stub#6354ebe7-c22a-4a0f-ac54-50b52ab9b065#java.lang(JDK/java.lang@java_stub)",
           "~Object"),
       thisNode))) {
     SNode superClassifier = SLinkOperations.getTarget(thisNode, "superclass", true);
     ListSequence.fromList(extendsClassifiers)
         .addElement(
             ((SLinkOperations.getTarget(superClassifier, "classifier", false) != null)
                 ? superClassifier
                 : BehaviorReflection.invokeVirtual(
                     (Class<SNode>) ((Class) Object.class),
                     SNodeOperations.getNode(
                         "f:java_stub#6354ebe7-c22a-4a0f-ac54-50b52ab9b065#java.lang(JDK/java.lang@java_stub)",
                         "~Object"),
                     "virtual_getThisType_3305065273710880775",
                     new Object[] {})));
   }
   ListSequence.fromList(extendsClassifiers)
       .addSequence(
           ListSequence.fromList(
                   SLinkOperations.getTargets(thisNode, "implementedInterface", true))
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return (SLinkOperations.getTarget(it, "classifier", false) != null);
                     }
                   }));
   return extendsClassifiers;
 }