diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-06-01 11:29:45 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-02 13:23:36 +0000 |
commit | 88bd8edcff23dc9cf31b664cba7ba73b235318b0 (patch) | |
tree | bda38d25837904f6e5320e3f54b91465a9aab3d9 /src/sksl/SkSLCFGGenerator.cpp | |
parent | ec4400bfe34bbb90eaceaae168b2c6edf9aca4d9 (diff) |
Fixed an issue with sksl variable declarations
There was an issue where multiple variables defined in the same
declaration were not being sequenced appropriately during analysis, so
'int x = 0, y = x + 1' would report that x was undefined.
Bug: skia:
Change-Id: I882f7e216467306f6a6013a0a34aac30a4c60744
Reviewed-on: https://skia-review.googlesource.com/18313
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLCFGGenerator.cpp')
-rw-r--r-- | src/sksl/SkSLCFGGenerator.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sksl/SkSLCFGGenerator.cpp b/src/sksl/SkSLCFGGenerator.cpp index 71bd37f39a..2fe049d9bd 100644 --- a/src/sksl/SkSLCFGGenerator.cpp +++ b/src/sksl/SkSLCFGGenerator.cpp @@ -465,13 +465,17 @@ void CFGGenerator::addStatement(CFG& cfg, std::unique_ptr<Statement>* s) { } case Statement::kVarDeclarations_Kind: { VarDeclarationsStatement& decls = ((VarDeclarationsStatement&) **s); - for (auto& vd : decls.fDeclaration->fVars) { - if (vd->fValue) { - this->addExpression(cfg, &vd->fValue, true); + for (auto& stmt : decls.fDeclaration->fVars) { + if (stmt->fKind == Statement::kNop_Kind) { + continue; } + VarDeclaration& vd = (VarDeclaration&) *stmt; + if (vd.fValue) { + this->addExpression(cfg, &vd.fValue, true); + } + cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, + false, nullptr, &stmt }); } - cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, - nullptr, s }); break; } case Statement::kDiscard_Kind: |