private void setSubject(SExpIR fieldExp, ACastUnaryExpIR castedFieldExp) { if (fieldExp instanceof AFieldExpIR) { ((AFieldExpIR) fieldExp).setObject(castedFieldExp); } else if (fieldExp instanceof AFieldNumberExpIR) { ((AFieldNumberExpIR) fieldExp).setTuple(castedFieldExp); } }
/** * Creates a new tree field only constructor {@code AFieldNumberExpIR TAG=fieldNumber} 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 field_ the {@link Long} node for the {@code field} child of this {@link AFieldNumberExpIR} node * @param tuple_ the {@link SExpIR} node for the {@code tuple} child of this {@link AFieldNumberExpIR} node */ public AFieldNumberExpIR(STypeIR type_, Long field_, SExpIR tuple_) { super(null,null,null,type_); this.setField(field_); this.setTuple(tuple_); }
/** * Creates a new complete constructor {@code AFieldNumberExpIR} 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 field_ the {@link Long} node for the {@code field} child of this {@link AFieldNumberExpIR} node * @param tuple_ the {@link SExpIR} node for the {@code tuple} child of this {@link AFieldNumberExpIR} node */ public AFieldNumberExpIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, STypeIR type_, Long field_, SExpIR tuple_) { super(sourceNode_,tag_,metaData_,type_); this.setField(field_); this.setTuple(tuple_); }
private AFieldNumberExpIR consTupleFieldExp( AIdentifierVarExpIR tuplePatternVar, int i, STypeIR currentType, boolean cast) { AFieldNumberExpIR fieldNumberExp = new AFieldNumberExpIR(); fieldNumberExp.setType(currentType.clone()); if (!cast) { fieldNumberExp.setTuple(tuplePatternVar.clone()); } else { ACastUnaryExpIR castedExp = new ACastUnaryExpIR(); castedExp.setType(tuplePatternVar.getType().clone()); castedExp.setExp(tuplePatternVar.clone()); fieldNumberExp.setTuple(castedExp); } fieldNumberExp.setField(new Long(1 + i)); return fieldNumberExp; }
@Override public SExpIR caseAFieldNumberExp(AFieldNumberExp node, IRInfo question) throws AnalysisException { long fieldCg = node.getField().getValue(); PType type = node.getType(); PExp tuple = node.getTuple(); AFieldNumberExpIR fieldNoExp = new AFieldNumberExpIR(); SExpIR tupleCg = tuple.apply(question.getExpVisitor(), question); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); fieldNoExp.setField(fieldCg); fieldNoExp.setType(typeCg); fieldNoExp.setTuple(tupleCg); return fieldNoExp; }