@Override public PType caseAImplicitFunctionDefinition( AImplicitFunctionDefinition node) throws AnalysisException { return node.getType(); }
public AFunctionType getType(AImplicitFunctionDefinition impdef, List<PType> actualTypes) { Iterator<PType> ti = actualTypes.iterator(); AFunctionType ftype = (AFunctionType) impdef.getType(); if (impdef.getTypeParams() != null) { for (ILexNameToken pname : impdef.getTypeParams()) { PType ptype = ti.next(); // AFunctionTypeAssistent. ftype = (AFunctionType) af.createPTypeAssistant().polymorph(ftype, pname, ptype); } ftype.setInstantiated(true); } return ftype; }
public AExplicitFunctionDefinition getPostDefinition( AImplicitFunctionDefinition d) { List<List<PPattern>> parameters = getParamPatternList(d); parameters.get(0).add(d.getResult().getPattern().clone()); @SuppressWarnings("unchecked") AExplicitFunctionDefinition def = AstFactory.newAExplicitFunctionDefinition(d.getName().getPostName(d.getPostcondition().getLocation()), NameScope.GLOBAL, (List<ILexNameToken>) d.getTypeParams().clone(), af.createAFunctionTypeAssistant().getPostType((AFunctionType) d.getType()), parameters, d.getPostcondition(), null, null, false, null); def.setAccess(d.getAccess().clone()); def.setClassDefinition(d.getClassDefinition()); return def; }
public POFunctionResultContext(AImplicitFunctionDefinition definition) { this.name = definition.getName(); this.deftype = (AFunctionType) definition.getType(); this.precondition = definition.getPrecondition(); this.body = definition.getBody(); this.implicit = true; this.result = definition.getResult(); this.function = definition; }
public AExplicitFunctionDefinition getPreDefinition( AImplicitFunctionDefinition d) { @SuppressWarnings("unchecked") AExplicitFunctionDefinition def = AstFactory.newAExplicitFunctionDefinition(d.getName().getPreName(d.getPrecondition().getLocation()), NameScope.GLOBAL, (List<ILexNameToken>) d.getTypeParams().clone(), af.createAFunctionTypeAssistant().getPreType((AFunctionType) d.getType()), getParamPatternList(d), d.getPrecondition(), null, null, false, null); def.setAccess(d.getAccess().clone()); def.setClassDefinition(d.getClassDefinition()); return def; }
public POFunctionDefinitionContext(AImplicitFunctionDefinition definition, boolean precond, IPogAssistantFactory assistantFactory) { this.name = definition.getName(); this.deftype = (AFunctionType) definition.getType(); this.addPrecond = precond; this.paramPatternList = assistantFactory .createAImplicitFunctionDefinitionAssistant() .getParamPatternList(definition); this.precondition = definition.getPrecondition(); this.argtypes = calculateTypes(deftype, false); }
public ParameterPatternObligation(AImplicitFunctionDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.FUNC_PATTERNS, ctxt, def.getLocation(), af); this.assistantFactory = af; stitch = generate(def.getPredef(), cloneListPatternList(assistantFactory.createAImplicitFunctionDefinitionAssistant().getParamPatternList(def)), cloneListType(((AFunctionType) def.getType()).getParameters()), ((AFunctionType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public FunctionValue(AImplicitFunctionDefinition def, FunctionValue precondition, FunctionValue postcondition, Context freeVariables) { this.location = def.getLocation(); this.name = def.getName().getName(); this.typeValues = null; this.type = (AFunctionType) def.getType(); this.paramPatternList = new Vector<List<PPattern>>(); PatternListTC plist = Interpreter.getInstance().getAssistantFactory().createPatternList(); for (APatternListTypePair ptp : def.getParamPatterns()) { plist.addAll(ptp.getPatterns()); } this.paramPatternList.add(plist); this.body = def.getBody(); this.result = def.getResult(); this.precondition = precondition; this.postcondition = postcondition; this.freeVariables = freeVariables; this.checkInvariants = true; this.classdef = def.getClassDefinition(); if (Settings.measureChecks && def.getMeasureName() != null) { measureName = def.getMeasureName(); measureValues = Collections.synchronizedMap(new HashMap<Long, Stack<Value>>()); } }
AVariableExp varExp = getVarExp(func.getName().clone(), func.clone(), func.getType().clone()); applyExp.setRoot(varExp); body = applyExp;
LexNameList pids = new LexNameList(); AFunctionType ftype = (AFunctionType) node.getType(); Iterator<PType> typeIter = ftype.getParameters().iterator(); || !assistantFactory.getTypeComparator().isSubType(node.getActualResult(), ((AFunctionType) node.getType()).getResult())) TypeCompatibilityObligation sto = TypeCompatibilityObligation.newInstance(node, ((AFunctionType) node.getType()).getResult(), node.getActualResult(), question, assistantFactory); if (sto != null)
mname.setTypeQualifier(imp.getType().getParameters());
String funcNameCg = node.getName().getName(); STypeIR typeCg = node.getType().apply(question.getTypeVisitor(), question);
throws AnalysisException question.assistantFactory.getTypeComparator().checkComposeTypes(node.getType(), question.env, false); List<PDefinition> defs = new Vector<PDefinition>(); List<PType> params = node.getType().getParameters(); if (question.env.isVDMPP()) exp.getName().setTypeQualifier(params); PDefinition def = question.env.findName(exp.getName(), question.scope); node.setType(node.getType()); return node.getType();