List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy)
List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy)
List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy)
@Override public PType caseAFunctionType(AFunctionType type, Newquestion question) throws AnalysisException { // return AFunctionTypeAssistantTC.polymorph(type, question.pname, question.actualType); List<PType> polyparams = new Vector<PType>(); for (PType ptype : type.getParameters()) { polyparams.add(af.createPTypeAssistant().polymorph(ptype, question.pname, question.actualType)); } // PType polyresult = PTypeAssistantTC.polymorph(type.getResult(), question.pname, question.actualType); PType polyresult = type.getResult().apply(this, question); AFunctionType ftype = AstFactory.newAFunctionType(type.getLocation(), false, polyparams, polyresult); ftype.setDefinitions(type.getDefinitions()); ftype.setInstantiated(true); return ftype; }
@SuppressWarnings("unchecked") public AFunctionType getPostType(AFunctionType t) { List<PType> params = new PTypeList(); params.addAll((List<PType>) t.getParameters().clone()); params.add(t.getResult().clone()); AFunctionType type = AstFactory.newAFunctionType(t.getLocation(), false, params, AstFactory.newABooleanBasicType(t.getLocation())); type.setDefinitions((List<? extends PDefinition>) t.getDefinitions().clone()); type.setInstantiated(null); return type; }
List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy)
List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy)
public static AExplicitFunctionDefinition newAExplicitFunctionDefinition( ILexNameToken name, NameScope scope, List<ILexNameToken> typeParams, AFunctionType type, List<List<PPattern>> parameters, PExp body, PExp precondition, PExp postcondition, boolean typeInvariant, PExp measure) { AExplicitFunctionDefinition result = new AExplicitFunctionDefinition(); // Definition initialization initDefinition(result, Pass.DEFS, name.getLocation(), name, scope); // AExplicitFunctionDefinition initialization result.setTypeParams(typeParams); result.setType(type); result.setParamPatternList(parameters); result.setPrecondition(precondition); result.setPostcondition(postcondition); result.setBody(body); result.setIsTypeInvariant(typeInvariant); result.setMeasure(measure); result.setIsCurried(parameters.size() > 1); result.setRecursive(false); result.setIsUndefined(false); result.setMeasureName(null); List<PDefinition> defsList = new LinkedList<PDefinition>(); defsList.add(result); type.getDefinitions().add(result); type.setInstantiated(typeParams == null || typeParams.isEmpty() ? null : false); return result; }
mtype.setDefinitions(type.getDefinitions()); return mtype;
@SuppressWarnings("unchecked") public AFunctionType getPreType(AFunctionType t) { AFunctionType type = AstFactory.newAFunctionType(t.getLocation(), false, (List<PType>) t.getParameters().clone(), AstFactory.newABooleanBasicType(t.getLocation())); type.setDefinitions((List<PDefinition>) t.getDefinitions().clone()); type.setInstantiated(null); return type; }
@SuppressWarnings("unchecked") public AFunctionType getCurriedPostType(AFunctionType type, Boolean isCurried) { if (isCurried && type.getResult() instanceof AFunctionType) { AFunctionType ft = (AFunctionType) type.getResult().clone(); AFunctionType t = AstFactory.newAFunctionType(type.getLocation(), false, ((List<PType>) type.getParameters().clone()), getCurriedPostType(ft, isCurried)); t.setDefinitions(type.getDefinitions()); t.setInstantiated(null); return t; } else { return getPostType(type); } }
@SuppressWarnings("unchecked") public AFunctionType getCurriedPreType(AFunctionType t, Boolean isCurried) { if (isCurried && t.getResult() instanceof AFunctionType) { AFunctionType ft = (AFunctionType) t.getResult().clone(); AFunctionType type = AstFactory.newAFunctionType(t.getLocation(), false, (List<PType>) t.getParameters().clone(), getCurriedPreType(ft, isCurried)); type.setDefinitions((List<PDefinition>) t.getDefinitions().clone()); type.setInstantiated(null); return type; } else { return getPreType(t); } }
PTypeSet set = new PTypeSet(question.assistantFactory); if (t.getDefinitions().size() == 0) } else boolean serious = t.getDefinitions().size() == 1; for (PDefinition def : t.getDefinitions()) // Possibly a union