Never add declarations without children to the AST
When block nodes were being created for loop bodies that didn't have
braces in the parsed source, the code didn't check if the loop body
was a declaration node without children. Always use appendStatement()
for adding statements to a block, so that declaration nodes without
children don't end up in the AST.
Similarly make sure that loop init nodes aren't declarations without
children.
BUG=chromium:712550
TEST=angle_end2end_tests
Change-Id: I5e79b700fe6158fa2422fcf4cd13818b2bd24863
Reviewed-on: https://chromium-review.googlesource.com/481660
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Intermediate.cpp b/src/compiler/translator/Intermediate.cpp
index 0b38eb5..37e1123 100644
--- a/src/compiler/translator/Intermediate.cpp
+++ b/src/compiler/translator/Intermediate.cpp
@@ -80,7 +80,7 @@
blockNode = new TIntermBlock();
blockNode->setLine(node->getLine());
- blockNode->getSequence()->push_back(node);
+ blockNode->appendStatement(node);
return blockNode;
}