/** * Creates a new complete constructor {@code ARecordPatternIR} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param typename_ the {@link String} node for the {@code typename} child of this {@link ARecordPatternIR} node * @param patterns_ the {@link NodeList} node for the {@code patterns} child of this {@link ARecordPatternIR} node * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link ARecordPatternIR} node */ public ARecordPatternIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, String typename_, List<? extends SPatternIR> patterns_, STypeIR type_) { super(sourceNode_,tag_,metaData_); this.setTypename(typename_); this.setPatterns(patterns_); this.setType(type_); }
/** * Creates a new tree field only constructor {@code ARecordPatternIR TAG=record} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param typename_ the {@link String} node for the {@code typename} child of this {@link ARecordPatternIR} node * @param patterns_ the {@link NodeList} node for the {@code patterns} child of this {@link ARecordPatternIR} node * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link ARecordPatternIR} node */ public ARecordPatternIR(String typename_, List<? extends SPatternIR> patterns_, STypeIR type_) { super(null,null,null); this.setTypename(typename_); this.setPatterns(patterns_); this.setType(type_); }
@Override public SPatternIR caseARecordPattern(ARecordPattern node, IRInfo question) throws AnalysisException { String typeName = node.getTypename().getName(); PType type = node.getType(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ARecordPatternIR recordPatternCg = new ARecordPatternIR(); recordPatternCg.setTypename(typeName); recordPatternCg.setType(typeCg); for (PPattern currentPattern : node.getPlist()) { SPatternIR patternCg = currentPattern.apply(question.getPatternVisitor(), question); if (patternCg != null) { recordPatternCg.getPatterns().add(patternCg); } else { return null; } } return recordPatternCg; } }