@Override public List<PDefinition> caseAImplicitFunctionDefinition( AImplicitFunctionDefinition node) throws AnalysisException { List<PDefinition> defs = new Vector<PDefinition>(); defs.add(node); if (node.getPredef() != null) { defs.add(node.getPredef()); } if (node.getPostdef() != null) { defs.add(node.getPostdef()); } if (node.getMeasureDef() != null && node.getMeasureName().getName().startsWith("measure_")) { defs.add(node.getMeasureDef()); } return defs; }
@Override public ILexNameToken caseAVariableExp(AVariableExp expression) throws AnalysisException { ILexNameToken result = null; AVariableExp var = AVariableExp.class.cast(expression); PDefinition def = af.createPDefinitionAssistant().deref(var.getVardef()); if (def instanceof AExplicitFunctionDefinition) { AExplicitFunctionDefinition ex = AExplicitFunctionDefinition.class.cast(def); PDefinition predef = ex.getPredef(); result = predef == null ? NO_PRECONDITION : predef.getName(); } else if (def instanceof AImplicitFunctionDefinition) { AImplicitFunctionDefinition im = AImplicitFunctionDefinition.class.cast(def); PDefinition predef = im.getPredef(); result = predef == null ? NO_PRECONDITION : predef.getName(); } return result; }
@Override public PExp caseAImplicitFunctionDefinition( AImplicitFunctionDefinition def, Integer lineno) throws AnalysisException { if (def.getPredef() != null) { PExp found = def.getPredef().apply(THIS, lineno); if (found != null) { return found; } } if (def.getPostdef() != null) { PExp found = def.getPostdef().apply(THIS, lineno); if (found != null) { return found; } } return def.getBody() == null ? null : af.createPExpAssistant().findExpression(def.getBody(), lineno); }
Context free = initialContext.getVisibleVariables(); FunctionValue prefunc = def.getPredef() == null ? null : new FunctionValue(def.getPredef(), null, null, free); nvl.add(new NameValuePair(def.getName(), func)); if (def.getPredef() != null) nvl.add(new NameValuePair(def.getPredef().getName(), prefunc)); prefunc.uninstantiated = !def.getTypeParams().isEmpty();
@Override public PDefinition caseAImplicitFunctionDefinition( AImplicitFunctionDefinition node, Newquestion question) throws AnalysisException { if (af.createPDefinitionAssistant().findNameBaseCase(node, question.sought, question.scope) != null) { return node; } PDefinition predef = node.getPredef(); if (predef != null && predef.apply(this, question) != null)// PDefinitionAssistantTC.findName(predef, sought, // scope) != null) { return predef; } PDefinition postdef = node.getPostdef(); if (postdef != null && postdef.apply(this, question) != null) // PDefinitionAssistantTC.findName(postdef, // sought, scope) != null) { return postdef; } PDefinition measureDef = node.getMeasureDef(); if (measureDef != null && measureDef.apply(this, question) != null) { return measureDef; } return null; }
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)); }
@Override public void caseAImplicitFunctionDefinition( AImplicitFunctionDefinition node, Environment question) throws AnalysisException { if (node.getPrecondition() != null) { node.setPredef(af.createAImplicitFunctionDefinitionAssistant().getPreDefinition(node)); af.createPDefinitionAssistant().markUsed(node.getPredef()); // af.createPDefinitionAssistant().markUsed(node.getPredef()); } else { node.setPredef(null); } if (node.getPostcondition() != null) { node.setPostdef(af.createAImplicitFunctionDefinitionAssistant().getPostDefinition(node)); af.createPDefinitionAssistant().markUsed(node.getPostdef()); } else { node.setPostdef(null); } }
PExp pred = generatePredicate(func.getPredef(), func.getPostdef(), cloneListPExp(params), body); stitch = pred; valuetree.setPredicate(ctxt.getPredWithContext(pred));
AExplicitFunctionDefinition preCond = node.getPredef(); SDeclIR preCondCg = preCond != null ? preCond.apply(question.getDeclVisitor(), question) : null;
node.getPredef().apply(this, question);
if (node.getPredef() != null) PType b = node.getPredef().getBody().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope)); ABooleanBasicType expected = AstFactory.newABooleanBasicType(node.getLocation()); qualified = node.getPredef().getBody().apply(question.assistantFactory.getQualificationVisitor(), new TypeCheckInfo(question.assistantFactory, local, question.scope));