Revert "Revert "SkSL function inlining""
This reverts commit 1b63b4ac6933ccddb15bcf650cd5747d5eba44d0.
Change-Id: I8120bb10cecc6889f4f4fd7b4c3a61d250e49219
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291358
Reviewed-by: Brian Osman <brianosman@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) {