@Override public PTypeSet caseACallStm(ACallStm statement) throws AnalysisException { // TODO We don't know what an operation call will raise return new PTypeSet(AstFactory.newAUnknownType(statement.getLocation()), af); }
public void checkArgTypes(ACallStm node, PType type, List<PType> ptypes, List<PType> atypes, TypeCheckInfo question) { if (ptypes.size() != atypes.size()) { TypeCheckerErrors.report(3216, "Expecting " + ptypes.size() + " arguments", node.getLocation(), node); } else { int i = 0; for (PType atype : atypes) { PType ptype = ptypes.get(i++); if (!question.assistantFactory.getTypeComparator().compatible(ptype, atype)) { TypeCheckerErrors.report(3217, "Unexpected type for argument " + i, node.getLocation(), type); TypeCheckerErrors.detail2("Expected", ptype, "Actual", atype); } } } }
public OperationCallObligation(ACallStm stm, SOperationDefinitionBase def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(stm, POType.OP_CALL, ctxt, stm.getLocation(), af); // cannot quote pre-cond so we spell it out with rewritten arguments List<Substitution> subs = new LinkedList<Substitution>(); for (int i = 0; i < stm.getArgs().size(); i++) { PPattern orig = def.getPredef().getParamPatternList().get(0).get(i); ILexNameToken origName = af.createPPatternAssistant().getAllVariableNames(orig).get(0).clone(); PExp new_exp = stm.getArgs().get(0); subs.add(new Substitution(origName, new_exp)); } PExp pre_exp = def.getPrecondition().clone(); for (Substitution sub : subs) { pre_exp = pre_exp.clone().apply(af.getVarSubVisitor(), sub); } stitch = pre_exp; valuetree.setPredicate(ctxt.getPredWithContext(pre_exp)); }
breakpoint.check(node.getLocation(), ctxt); boolean endstop = breakpoint.catchReturn(ctxt); Value rv = op.eval(node.getLocation(), argValues, ctxt); Value rv = fn.eval(node.getLocation(), argValues, ctxt); return VdmRuntimeError.abort(node.getLocation(), e);
+ " is not in scope", node.getLocation(), node); question.env.listAlternatives(node.getName()); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); + " is not static", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); TypeCheckerErrors.report(3337, "Cannot call a constructor from here", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); + " from static context", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); TypeCheckerErrors.report(3339, "Cannot call impure operation from a pure operation", node.getLocation(), node); return question.assistantFactory.createPTypeAssistant().checkReturnType(question.returnType, optype.getResult(), node.getLocation()); } else if (question.assistantFactory.createPTypeAssistant().isFunction(type)) return question.assistantFactory.createPTypeAssistant().checkReturnType(question.returnType, ftype.getResult(), node.getLocation()); } else TypeCheckerErrors.report(3210, "Name is neither a function nor an operation", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType();