@Override public IProofObligationList defaultPStm(PStm node, IPOContextStack question) throws AnalysisException { return node.apply(pogStmVisitor, question); }
@Override public ILexLocation defaultPStm(PStm node) throws AnalysisException { return node.getLocation(); }
@Override public String defaultPStm(PStm node, PrettyPrinterEnv question) throws AnalysisException { return node.toString(); }
@Override public PType caseATrapStm(ATrapStm node, TypeCheckInfo question) throws AnalysisException { PTypeSet rtypes = new PTypeSet(question.assistantFactory); PStm body = node.getBody(); PType bt = body.apply(THIS, question); rtypes.add(bt); PTypeSet extype = exitCheck(body, question); PType ptype = null; if (extype.isEmpty()) { TypeCheckerErrors.report(3241, "Body of trap statement does not throw exceptions", node.getLocation(), node); ptype = AstFactory.newAUnknownType(body.getLocation()); } else { ptype = extype.getType(body.getLocation()); } node.setType(ptype); node.getPatternBind().apply(THIS, question); // TODO: PatternBind stuff List<PDefinition> defs = getDefinitions(node.getPatternBind()); question.assistantFactory.createPDefinitionListAssistant().typeCheck(defs, THIS, question); Environment local = new FlatCheckedEnvironment(question.assistantFactory, defs, question.env, question.scope); rtypes.add(node.getWith().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers))); node.setType(rtypes.getType(node.getLocation())); return node.getType(); }
@Override public PType caseAThreadDefinition(AThreadDefinition node, TypeCheckInfo question) throws AnalysisException { question.scope = NameScope.NAMESANDSTATE; FlatEnvironment local = new FlatEnvironment(question.assistantFactory, question.assistantFactory.createPDefinitionAssistant().getSelfDefinition(node), question.env); PType rt = node.getStatement().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope)); if (!(rt instanceof AVoidType) && !(rt instanceof AUnknownType)) { TypeCheckerErrors.report(3049, "Thread statement/operation must not return a value", node.getLocation(), node); } node.setType(rt); node.getOperationDef().setBody(node.getStatement().clone());// This // operation // is a // wrapper // for the // thread return rt; }
private List<ACaseAlternativeStm> readCaseAlternatives() throws ParserException, LexException { List<ACaseAlternativeStm> alts = new Vector<ACaseAlternativeStm>(); List<PPattern> plist = getPatternReader().readPatternList(); checkFor(VDMToken.ARROW, 2236, "Expecting '->' after case pattern list"); PStm result = readStatement(); for (PPattern p : plist) { p.getLocation().executable(true); alts.add(AstFactory.newACaseAlternativeStm(p.clone(), result.clone())); } return alts; }
PType stype = stmt.apply(THIS, question); TypeCheckerErrors.warning(5006, "Statement will not be reached", stmt.getLocation(), stmt); } else
/** * Sets the {@code _others} child of this {@link ACasesStm} node. * @param value the new {@code _others} child of this {@link ACasesStm} node */ public void setOthers(PStm value) { if (this._others != null) { this._others.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._others = value; }
public AExplicitOperationDefinition getThreadDefinition(AThreadDefinition d) { AOperationType type = AstFactory.newAOperationType(d.getLocation()); // () ==> () AExplicitOperationDefinition def = AstFactory.newAExplicitOperationDefinition(d.getOperationName(), type, new Vector<PPattern>(), null, null, d.getStatement().clone()); def.setAccess(d.getAccess().clone()); def.setClassDefinition(d.getClassDefinition()); return def; }
private void visitStms(List<? extends PStm> stms) throws AnalysisException { for (PStm stm : stms) { stm.apply(this); } } }
@Override public Boolean defaultInPStm(PStm node) throws AnalysisException { if (!isValidModule(node.getLocation())) { invalidNodes.add(node); return false; } return true; }
/** * Sets the {@code _thenStm} child of this {@link AElseIfStm} node. * @param value the new {@code _thenStm} child of this {@link AElseIfStm} node */ public void setThenStm(PStm value) { if (this._thenStm != null) { this._thenStm.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._thenStm = value; }
@Override public String toString() { return statement.toString(); }
} else statement = statement.clone(); test.set(i, statement); interpreter.typeCheck(statement, env);
@Override public PType defaultPStm(PStm node, TypeCheckInfo question) throws AnalysisException { return node.apply(tcStm, question); }
public static Breakpoint getBreakpoint(PStm stmt) { if (!statementMap.containsKey(stmt)) { statementMap.put(stmt, new Breakpoint(stmt.getLocation())); } return statementMap.get(stmt); }
/** * Sets the {@code _statement} child of this {@link AForIndexStm} node. * @param value the new {@code _statement} child of this {@link AForIndexStm} node */ public void setStatement(PStm value) { if (this._statement != null) { this._statement.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._statement = value; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); String sep = ""; for (PStm stmt : this) { if (!(stmt instanceof TraceVariableStatement)) { sb.append(sep); sb.append(stmt.toString()); sep = "; "; } } return sb.toString(); }