@Override public PatternListTC createPatternList() { return new PatternListTC(this); }
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>>()); } }
@Override public Value caseALambdaExp(ALambdaExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); // Free variables are everything currently visible from this // context (but without the context chain). Context free = ctxt.getVisibleVariables(); PatternListTC list = ctxt.assistantFactory.createPatternList(); list.addAll(node.getParamPatterns()); // Resolve any @T types referred to in the type parameters IQuestionAnswer<Context, PType> instantiator = ctxt.assistantFactory.getAllConcreteTypeInstantiator(); PType ftype = node.getType().apply(instantiator, ctxt); return new FunctionValue(node.getLocation(), "lambda", (AFunctionType) ftype, list, node.getExpression(), free); }