Use FindMainBody to retrieve node of main()'s body
The patch addresses code duplication in cases in which main()'s body node
has to be retrieved from the AST.
TEST=angle_unittests
Change-Id: I0ccee41821a5ecb2cdf09f5a928b178d6c037587
Reviewed-on: https://chromium-review.googlesource.com/561521
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/UseInterfaceBlockFields.cpp b/src/compiler/translator/UseInterfaceBlockFields.cpp
index c1391d4..bd9666f 100644
--- a/src/compiler/translator/UseInterfaceBlockFields.cpp
+++ b/src/compiler/translator/UseInterfaceBlockFields.cpp
@@ -100,9 +100,7 @@
const InterfaceBlockList &blocks,
const TSymbolTable &symbolTable)
{
- TIntermFunctionDefinition *main = FindMain(root);
- TIntermBlock *mainBody = main->getBody();
- ASSERT(mainBody);
+ TIntermBlock *mainBody = FindMainBody(root);
InsertUseCode(mainBody->getSequence(), blocks, symbolTable);
}