public void applyRule( final SNode debuggerReference, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { if (SNodeOperations.isInstanceOf( SNodeOperations.getContainingRoot(debuggerReference), "jetbrains.mps.debugger.api.lang.structure.BreakpointCreator")) { Set<SNode> throwables = SetSequence.fromSet(new HashSet<SNode>()); SetSequence.fromSet(throwables).addElement(_quotation_createNode_fpej4j_a0a1a0a1()); RulesFunctions_BaseLanguage.check(typeCheckingContext, throwables, debuggerReference); } }
public void applyRule( final SNode bmd, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { SNode expectedRetType = BehaviorReflection.invokeVirtual( (Class<SNode>) ((Class) Object.class), bmd, "virtual_getExpectedRetType_1239354342632", new Object[] {}); Iterable<SNode> returnStatements = RulesFunctions_BaseLanguage.collectReturnStatements( SLinkOperations.getTarget(bmd, "body", true)); if (expectedRetType == null) { for (SNode returnStatement : Sequence.fromIterable(returnStatements)) { if ((SLinkOperations.getTarget(returnStatement, "expression", true) != null)) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportTypeError( returnStatement, "no return value expected", "r:00000000-0000-4000-0000-011c8959050e(jetbrains.mps.quickQueryLanguage.typesystem)", "5046156961652249728", null, errorTarget); } } } } else { for (SNode returnStatement : Sequence.fromIterable(returnStatements)) { if ((SLinkOperations.getTarget(returnStatement, "expression", true) == null)) { { MessageTarget errorTarget = new NodeMessageTarget(); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportTypeError( returnStatement, "should return value", "r:00000000-0000-4000-0000-011c8959050e(jetbrains.mps.quickQueryLanguage.typesystem)", "5046156961652249747", null, errorTarget); } } else { SNode returnType = typeCheckingContext.typeOf( SLinkOperations.getTarget(returnStatement, "expression", true), "r:00000000-0000-4000-0000-011c8959050e(jetbrains.mps.quickQueryLanguage.typesystem)", "5046156961652249760", true); { SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(returnStatement, "expression", true); EquationInfo _info_12389875345 = new EquationInfo( _nodeToCheck_1029348928467, "" + expectedRetType + " is expected", "r:00000000-0000-4000-0000-011c8959050e(jetbrains.mps.quickQueryLanguage.typesystem)", "5046156961652249764", 0, null); typeCheckingContext.createLessThanInequality( (SNode) returnType, (SNode) expectedRetType, false, true, _info_12389875345); } } } } if (expectedRetType != null) { SNode lastStatement = BehaviorReflection.invokeVirtual( (Class<SNode>) ((Class) Object.class), bmd, "virtual_getLastStatement_1239354409446", new Object[] {}); if (SNodeOperations.isInstanceOf( lastStatement, "jetbrains.mps.baseLanguage.structure.ExpressionStatement")) { SNode returnType = typeCheckingContext.typeOf( SLinkOperations.getTarget( SNodeOperations.cast( lastStatement, "jetbrains.mps.baseLanguage.structure.ExpressionStatement"), "expression", true), "r:00000000-0000-4000-0000-011c8959050e(jetbrains.mps.quickQueryLanguage.typesystem)", "5046156961652249794", true); { SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget( SNodeOperations.cast( lastStatement, "jetbrains.mps.baseLanguage.structure.ExpressionStatement"), "expression", true); EquationInfo _info_12389875345 = new EquationInfo( _nodeToCheck_1029348928467, expectedRetType + " is expected", "r:00000000-0000-4000-0000-011c8959050e(jetbrains.mps.quickQueryLanguage.typesystem)", "5046156961652249799", 0, null); typeCheckingContext.createLessThanInequality( (SNode) returnType, (SNode) expectedRetType, false, true, _info_12389875345); } } } }