@Override public AVarDeclIR getNextElementDeclared(AIdentifierVarExpIR setVar, List<SPatternIR> patterns, SPatternIR pattern) throws AnalysisException { AVarDeclIR nextElementDecl = decls.get(count++); tagNextElementDeclared(nextElementDecl); nextElementDecl.setExp(langIterator.consNextElementCall(setVar)); return nextElementDecl; }
public void setDefaultValue(AVarDeclIR localDecl, STypeIR typeCg) { ExpAssistantIR expAssistant = assistantManager.getExpAssistant(); if (typeCg instanceof AStringTypeIR) { localDecl.setExp(expAssistant.getDefaultStringlValue()); } else if (typeCg instanceof ACharBasicTypeIR) { localDecl.setExp(expAssistant.getDefaultCharlValue()); } else if (typeCg instanceof AIntNumericBasicTypeIR) { localDecl.setExp(expAssistant.getDefaultIntValue()); } else if (typeCg instanceof ANat1NumericBasicTypeIR) { localDecl.setExp(expAssistant.getDefaultNat1Value()); } else if (typeCg instanceof ANatNumericBasicTypeIR) { localDecl.setExp(expAssistant.getDefaultNatValue()); } else if (typeCg instanceof ARealNumericBasicTypeIR) { localDecl.setExp(expAssistant.getDefaultRealValue()); } else if (typeCg instanceof ABoolBasicTypeIR) { localDecl.setExp(expAssistant.getDefaultBoolValue()); } else { localDecl.setExp(assistantManager.getExpAssistant().consUndefinedExp()); } }
/** * Creates a new complete constructor {@code AVarDeclIR} 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 final_ the {@link Boolean} node for the {@code final} child of this {@link AVarDeclIR} node * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link AVarDeclIR} node * @param pattern_ the {@link SPatternIR} node for the {@code pattern} child of this {@link AVarDeclIR} node * @param exp_ the {@link SExpIR} node for the {@code exp} child of this {@link AVarDeclIR} node */ public AVarDeclIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, Boolean final_, STypeIR type_, SPatternIR pattern_, SExpIR exp_) { super(sourceNode_,tag_,metaData_); this.setFinal(final_); this.setType(type_); this.setPattern(pattern_); this.setExp(exp_); }
/** * Creates a new tree field only constructor {@code AVarDeclIR TAG=var} 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 final_ the {@link Boolean} node for the {@code final} child of this {@link AVarDeclIR} node * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link AVarDeclIR} node * @param pattern_ the {@link SPatternIR} node for the {@code pattern} child of this {@link AVarDeclIR} node * @param exp_ the {@link SExpIR} node for the {@code exp} child of this {@link AVarDeclIR} node */ public AVarDeclIR(Boolean final_, STypeIR type_, SPatternIR pattern_, SExpIR exp_) { super(null,null,null); this.setFinal(final_); this.setType(type_); this.setPattern(pattern_); this.setExp(exp_); }
public AVarDeclIR consLocalVarDecl(INode node, STypeIR type, SPatternIR pattern, SExpIR exp) { AVarDeclIR localVarDecl = new AVarDeclIR(); localVarDecl.setType(type); localVarDecl.setFinal(false); localVarDecl.setSourceNode(node != null ? new SourceNode(node) : null); localVarDecl.setPattern(pattern); localVarDecl.setExp(exp); return localVarDecl; }
private void initSuccessVar(PatternBlockData patternData, SExpIR initExp, ABlockStmIR patternBlock) { if (patternData.getSuccessVarDecl().getExp() instanceof AUndefinedExpIR) { patternData.getSuccessVarDecl().setExp(initExp); } else { AAssignToExpStmIR successVarAssignment = new AAssignToExpStmIR(); successVarAssignment.setTarget(patternData.getSuccessVar().clone()); successVarAssignment.setExp(initExp); patternBlock.getStatements().add(successVarAssignment); } }
} else localDecl.setExp(expCg);