Revert "Reland "Revert "SkSL function inlining"""
This reverts commit 04ff61faae9bd55ef77cc1e2fae7890c67773631.
Change-Id: Ieb69c76b161ec9e003982d36bb2e28d055ad47a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292266
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLMetalCodeGenerator.cpp b/src/sksl/SkSLMetalCodeGenerator.cpp
index 099ab4c..2b222d8 100644
--- a/src/sksl/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/SkSLMetalCodeGenerator.cpp
@@ -1164,11 +1164,15 @@
}
void MetalCodeGenerator::writeBlock(const Block& b) {
- this->writeLine("{");
- fIndentation++;
+ if (b.fIsScope) {
+ this->writeLine("{");
+ fIndentation++;
+ }
this->writeStatements(b.fStatements);
- fIndentation--;
- this->write("}");
+ if (b.fIsScope) {
+ fIndentation--;
+ this->write("}");
+ }
}
void MetalCodeGenerator::writeIfStatement(const IfStatement& stmt) {