@Override public PTypeList caseASeqSeqType(ASeqSeqType node) throws AnalysisException { return node.getSeqof().apply(THIS); }
public SSeqType getSeq(PType type) { try { return type.apply(af.getSeqTypeFinder()); } catch (AnalysisException e) { return null; } }
public boolean isMap(PType type) { try { return type.apply(af.getMapBasisChecker()); } catch (AnalysisException e) { return false; } }
public SSetType getSet(PType type) { try { return type.apply(af.getSetTypeFinder()); } catch (AnalysisException e) { return null; } }
public boolean isProduct(PType type, int size) { try { return type.apply(af.getProductExtendedChecker(), size); } catch (AnalysisException e) { return false; } }
public boolean isVoid(PType type) { try { return type.apply(af.getVoidBasisChecker()); } catch (AnalysisException e) { return false; } }
private STypeIR consExportType(PType type, IRInfo question) throws AnalysisException { if (type != null) { return type.apply(question.getTypeVisitor(), question); } else { return null; } }
@Override public Integer caseAOptionalType(AOptionalType type) throws AnalysisException { return type.getType().apply(THIS); }
@Override public LexNameSet caseAOptionalType(AOptionalType node, FreeVarInfo info) throws AnalysisException { return node.getType().apply(this, info); }
public PType typeResolve(PType type, ATypeDefinition root, IQuestionAnswer<TypeCheckInfo, PType> rootVisitor, TypeCheckInfo question) { try { return type.apply(af.getPTypeResolver(), new PTypeResolver.Newquestion(root, rootVisitor, question)); } catch (AnalysisException e) { return null; } }
@Override public STypeIR caseABracketType(ABracketType node, IRInfo question) throws AnalysisException { PType type = node.getType(); return type.apply(question.getTypeVisitor(), question); }
@Override public ValueList caseAOptionalType(AOptionalType type, Context ctxt) throws AnalysisException { ValueList list = type.getType().apply(THIS, ctxt); list.add(new NilValue()); return list; }
@Override public PTypeList caseAUnionType(AUnionType node) throws AnalysisException { PTypeList list = new PTypeList(); for (PType ptype : node.getTypes()) { list.addAll(ptype.apply(THIS)); } return list; }
@Override public LexNameSet caseAProductType(AProductType node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); for (PType p: node.getTypes()) { names.addAll(p.apply(this, info)); } return names; }
@Override public SExpIR caseASelfExp(ASelfExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ASelfExpIR selfExpCg = new ASelfExpIR(); selfExpCg.setType(typeCg); return selfExpCg; }
@Override public STypeIR defaultSSetType(SSetType node, IRInfo question) throws AnalysisException { PType setOf = node.getSetof(); STypeIR typeCg = setOf.apply(question.getTypeVisitor(), question); boolean empty = node.getEmpty(); ASetSetTypeIR setType = new ASetSetTypeIR(); setType.setSetOf(typeCg); setType.setEmpty(empty); return setType; }
@Override public SExpIR caseABooleanConstExp(ABooleanConstExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); boolean value = node.getValue().getValue(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ABoolLiteralExpIR boolLitCg = new ABoolLiteralExpIR(); boolLitCg.setType(typeCg); boolLitCg.setValue(value); return boolLitCg; }
@Override public void caseAInstanceVariableDefinition( AInstanceVariableDefinition node) throws AnalysisException { handleNameToken(node, node.getName()); handleNameToken(node, node.getOldname()); node.getExpression().apply(this); node.getType().apply(this); }
private AVarDeclIR consLocalVarDecl(AValueDefinition valueDef, IRInfo question) throws AnalysisException { STypeIR type = valueDef.getType().apply(question.getTypeVisitor(), question); SPatternIR pattern = valueDef.getPattern().apply(question.getPatternVisitor(), question); SExpIR exp = valueDef.getExpression().apply(question.getExpVisitor(), question); return consLocalVarDecl(valueDef, type, pattern, exp); }