/** * Called by the {@link APatternTypePair} node from {@link APatternTypePair#apply(IPOFAnalysis)}. * @param node the calling {@link APatternTypePair} node */ public void caseAPatternTypePair(APatternTypePair node) throws AnalysisException { _visitedNodes.add(node); inAPatternTypePair(node); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { node.getPattern().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outAPatternTypePair(node); }
/** * Called by the {@link APatternTypePair} node from {@link APatternTypePair#apply(IAnalysis)}. * @param node the calling {@link APatternTypePair} node */ public void caseAPatternTypePair(APatternTypePair node) throws AnalysisException { _visitedNodes.add(node); inAPatternTypePair(node); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { node.getPattern().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outAPatternTypePair(node); }
/** * Called by the {@link APatternTypePair} node from {@link APatternTypePair#apply(IAnalysis)}. * @param node the calling {@link APatternTypePair} node */ public void caseAPatternTypePair(APatternTypePair node, Q question) throws AnalysisException { _visitedNodes.add(node); inAPatternTypePair(node, question); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { node.getPattern().apply(this, question); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } outAPatternTypePair(node, question); }
public List<PDefinition> getDefinitions(APatternTypePair result) { return af.createPPatternAssistant().getDefinitions(result.getPattern(), result.getType(), NameScope.LOCAL); }
/** * Called by the {@link APatternTypePair} node from {@link APatternTypePair#apply(IAnalysis)}. * @param node the calling {@link APatternTypePair} node */ public A caseAPatternTypePair(APatternTypePair node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAPatternTypePair(node)); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { mergeReturns(retVal,node.getPattern().apply(this)); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } mergeReturns(retVal,outAPatternTypePair(node)); return retVal; }
/** * Called by the {@link APatternTypePair} node from {@link APatternTypePair#apply(IAnalysis)}. * @param node the calling {@link APatternTypePair} node */ public A caseAPatternTypePair(APatternTypePair node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAPatternTypePair(node, question)); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { mergeReturns(retVal,node.getPattern().apply(this, question)); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } mergeReturns(retVal,outAPatternTypePair(node, question)); return retVal; }
public void typeResolve(APatternTypePair result, IQuestionAnswer<TypeCheckInfo, PType> rootVisitor, TypeCheckInfo question) { if (result.getResolved()) { return; } else { result.setResolved(true); } result.setType(af.createPTypeAssistant().typeResolve(result.getType(), null, rootVisitor, question)); }
patternList.add(result.getPattern().clone()); tmBind.setPlist(patternList); tmBind.setType(result.getType().clone()); binds.add(tmBind); exists_exp.setBindList(binds); AEqualsDefinition localDef = new AEqualsDefinition(); localDef.setPattern(result.getPattern().clone()); localDef.setType(result.getType().clone()); localDef.setTest(body.clone()); List<PDefinition> defs = new LinkedList<PDefinition>();
AFunctionType type = AstFactory.newAFunctionType(result.getLocation(), false, ptypes, resultPattern.getType()); type.setInstantiated(typeParams == null || typeParams.isEmpty() ? null : false);
public static AImplicitOperationDefinition newAImplicitOperationDefinition( ILexNameToken name, List<APatternListTypePair> parameterPatterns, APatternTypePair resultPattern, PStm body, ASpecificationStm spec) { AImplicitOperationDefinition result = new AImplicitOperationDefinition(); // Definition initialization initDefinition(result, Pass.DEFS, name.getLocation(), name, NameScope.GLOBAL); result.setParameterPatterns(parameterPatterns); result.setResult(resultPattern); result.setBody(body); result.setExternals(spec.getExternals()); result.setPrecondition(spec.getPrecondition()); result.setPostcondition(spec.getPostcondition()); result.setErrors(spec.getErrors()); result.setIsConstructor(false); List<PType> ptypes = new Vector<PType>(); for (APatternListTypePair ptp : parameterPatterns) { ptypes.addAll(getTypeList(ptp)); } AOperationType operationType = AstFactory.newAOperationType(result.getLocation(), ptypes, result.getResult() == null ? AstFactory.newAVoidType(name.getLocation()) : result.getResult().getType()); result.setType(operationType); return result; }
existsExp.setBindList(getMultipleTypeBindList(func.getResult().getType().clone(), ip.getName())); } else
existsExp.setBindList(getMultipleTypeBindList(op.getResult().getType().clone(), ip.getName().clone())); } else
node.setActualResult(node.getBody().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers, node.getResult().getType(), null))); if (!question.assistantFactory.getTypeComparator().compatible(node.getResult().getType(), node.getActualResult())) TypeCheckerErrors.detail2("Actual", node.getActualResult(), "Expected", node.getResult().getType());