public void setFinalLocalDefs(List<PDefinition> localDefs, List<AVarDeclIR> localDecls, IRInfo question) throws AnalysisException { for (PDefinition def : localDefs) { AVarDeclIR varDecl = null; if (def instanceof AValueDefinition) { varDecl = consLocalVarDecl((AValueDefinition) def, question); } else if (def instanceof AEqualsDefinition) { varDecl = consLocalVarDecl((AEqualsDefinition) def, question); } if (varDecl != null) { varDecl.setFinal(true); localDecls.add(varDecl); } else { log.error("Problems encountered when trying to construct local variable"); } } }
public AVarDeclIR consClassVarDeclDefaultCtor(String className, String varName) { AClassTypeIR classType = consClassType(className); ANewExpIR init = consDefaultConsCall(className); AVarDeclIR classDecl = consDecl(varName, classType, init); classDecl.setFinal(true); return classDecl; }
/** * 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; }
@Override public List<AVarDeclIR> getOuterBlockDecls(AIdentifierVarExpIR setVar, List<SPatternIR> patterns) throws AnalysisException { STypeIR elementType = transAssist.getElementType(setSeqType); for (SPatternIR id : patterns) { AVarDeclIR decl = transAssist.getInfo().getDeclAssistant().consLocalVarDecl(elementType.clone(), id.clone(), transAssist.getInfo().getExpAssistant().consUndefinedExp()); decl.setFinal(true); decls.add(decl); } return packDecl(altTests); }
public AVarDeclIR consIdConstDecl(String idConstName) { ANatNumericBasicTypeIR intType = new ANatNumericBasicTypeIR(); AClassTypeIR idGenType = transAssistant.consClassType(tracePrefixes.idGeneratorClassName()); SExpIR init = transAssistant.consInstanceCall(idGenType, tracePrefixes.idGeneratorVarName(), intType, tracePrefixes.idGeneratorIncrementMethodName()); AVarDeclIR idConstDecl = transAssistant.consDecl(idConstName, intType.clone(), init); idConstDecl.setFinal(true); return idConstDecl; }
argDecl.setFinal(true); decls.add(argDecl);
decCopy.setFinal(true); declBlock.getLocalDefs().add(decCopy);