TIntermDeclaration* ir_add_declaration(TIntermSymbol* symbol, TIntermTyped* initializer, TSourceLoc line, TInfoSink& infoSink) { TIntermDeclaration* decl = new TIntermDeclaration(symbol->getType()); decl->setLine(line); if (!initializer) decl->getDeclaration() = symbol; else decl->getDeclaration() = ir_add_assign(EOpAssign, symbol, initializer, line, infoSink); return decl; }
TIntermDeclaration* ir_add_declaration(TIntermSymbol* symbol, TIntermTyped* initializer, TSourceLoc line, TParseContext& ctx) { TIntermDeclaration* decl = new TIntermDeclaration(symbol->getType()); decl->setLine(line); if (!initializer) decl->getDeclaration() = symbol; else { TIntermTyped* t = ir_add_assign(EOpAssign, symbol, initializer, line, ctx); if (!t) { delete decl; return NULL; } decl->getDeclaration() = t; } return decl; }