@Override public LexNameSet caseASeq1SeqType(ASeq1SeqType node, FreeVarInfo info) throws AnalysisException { return node.getSeqof().apply(this, info); }
@Override public String caseASeq1SeqType(ASeq1SeqType type) throws AnalysisException { return type.getEmpty() ? "[]" : "seq1 of (" + type.getSeqof() + ")"; }
@Override public PTypeList caseASeq1SeqType(ASeq1SeqType node) throws AnalysisException { return node.getSeqof().apply(THIS); }
@Override public String caseASeq1SeqType(ASeq1SeqType node, PrettyPrinterEnv question) throws AnalysisException { return "" + "seq1 of (" + node.getSeqof().apply(this, question) + ")"; }
/** * Called by the {@link ASeq1SeqType} node from {@link ASeq1SeqType#apply(IAnalysis)}. * @param node the calling {@link ASeq1SeqType} node */ public void caseASeq1SeqType(ASeq1SeqType node) throws AnalysisException { _visitedNodes.add(node); inASeq1SeqType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getSeqof() != null && !_visitedNodes.contains(node.getSeqof())) { node.getSeqof().apply(this); } outASeq1SeqType(node); }
/** * Called by the {@link ASeq1SeqType} node from {@link ASeq1SeqType#apply(IPOFAnalysis)}. * @param node the calling {@link ASeq1SeqType} node */ public void caseASeq1SeqType(ASeq1SeqType node) throws AnalysisException { _visitedNodes.add(node); inASeq1SeqType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getSeqof() != null && !_visitedNodes.contains(node.getSeqof())) { node.getSeqof().apply(this); } outASeq1SeqType(node); }
/** * Called by the {@link ASeq1SeqType} node from {@link ASeq1SeqType#apply(IAnalysis)}. * @param node the calling {@link ASeq1SeqType} node */ public void caseASeq1SeqType(ASeq1SeqType node, Q question) throws AnalysisException { _visitedNodes.add(node); inASeq1SeqType(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getSeqof() != null && !_visitedNodes.contains(node.getSeqof())) { node.getSeqof().apply(this, question); } outASeq1SeqType(node, question); }
@Override public Boolean caseASeq1SeqType(ASeq1SeqType type, Object other) throws AnalysisException { other = deBracket((PType) other); if (other instanceof ASeq1SeqType) { ASeq1SeqType os = (ASeq1SeqType) other; // NB. Empty sequence is the same type as any sequence return type.getEmpty() || os.getEmpty() || af.createPTypeAssistant().equals(type.getSeqof(), os.getSeqof()); } return false; }
/** * Called by the {@link ASeq1SeqType} node from {@link ASeq1SeqType#apply(IAnalysis)}. * @param node the calling {@link ASeq1SeqType} node */ public A caseASeq1SeqType(ASeq1SeqType node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inASeq1SeqType(node, question)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getSeqof() != null && !_visitedNodes.contains(node.getSeqof())) { mergeReturns(retVal,node.getSeqof().apply(this, question)); } mergeReturns(retVal,outASeq1SeqType(node, question)); return retVal; }
/** * Called by the {@link ASeq1SeqType} node from {@link ASeq1SeqType#apply(IAnalysis)}. * @param node the calling {@link ASeq1SeqType} node */ public A caseASeq1SeqType(ASeq1SeqType node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inASeq1SeqType(node)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getSeqof() != null && !_visitedNodes.contains(node.getSeqof())) { mergeReturns(retVal,node.getSeqof().apply(this)); } mergeReturns(retVal,outASeq1SeqType(node)); return retVal; }
@Override public PType caseATailUnaryExp(ATailUnaryExp node, TypeCheckInfo question) throws AnalysisException { PExp exp = node.getExp(); question.qualifiers = null; PType etype = exp.apply(THIS, question.newConstraint(null)); if (!question.assistantFactory.createPTypeAssistant().isSeq(etype)) { TypeCheckerErrors.report(3179, "Argument to 'tl' is not a sequence", node.getLocation(), node); node.setType(AstFactory.newASeqSeqType(node.getLocation(), AstFactory.newAUnknownType(node.getLocation()))); return node.getType(); } else if (etype instanceof ASeq1SeqType) { ASeq1SeqType s = (ASeq1SeqType)etype; etype = AstFactory.newASeqSeqType(node.getLocation(), s.getSeqof()); } node.setType(etype); return etype; }
ASeqSeqType st = AstFactory.newASeqSeqType(s1t.getLocation(), s1t.getSeqof()); if (contains(st))