Fix cases of variable shadowing in SkSL.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.
Change-Id: Ic582c59b9f7dfee2d7e90e50bfb36c57e958c673
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436641
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/codegen/SkSLMetalCodeGenerator.cpp b/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
index ce4e93f..c6d24e0 100644
--- a/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLMetalCodeGenerator.cpp
@@ -1751,14 +1751,14 @@
}
const StatementArray& block = stmt->as<Block>().children();
for (int index = block.count(); index--; ) {
- const Statement& stmt = *block[index];
- if (stmt.is<ReturnStatement>()) {
+ stmt = block[index].get();
+ if (stmt->is<ReturnStatement>()) {
return true;
}
- if (stmt.is<Block>()) {
- return is_block_ending_with_return(&stmt);
+ if (stmt->is<Block>()) {
+ return is_block_ending_with_return(stmt);
}
- if (!stmt.is<Nop>()) {
+ if (!stmt->is<Nop>()) {
break;
}
}