moved SkSL FunctionDefinition data into IRNode

Change-Id: Ia828de0793ee66301ba315f4593b4d7d69222b4e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326717
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index c80374d..bbb6ee0 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -660,10 +660,10 @@
 
     // Create a variable to hold the result in the extra statements (excepting void).
     std::unique_ptr<Expression> resultExpr;
-    if (function.fDeclaration.returnType() != *fContext->fVoid_Type) {
+    if (function.declaration().returnType() != *fContext->fVoid_Type) {
         std::unique_ptr<Expression> noInitialValue;
-        resultExpr = makeInlineVar(String(function.fDeclaration.name()),
-                                   &function.fDeclaration.returnType(),
+        resultExpr = makeInlineVar(String(function.declaration().name()),
+                                   &function.declaration().returnType(),
                                    Modifiers{}, &noInitialValue);
    }
 
@@ -672,13 +672,13 @@
     VariableRewriteMap varMap;
     std::vector<int> argsToCopyBack;
     for (int i = 0; i < (int) arguments.size(); ++i) {
-        const Variable* param = function.fDeclaration.parameters()[i];
+        const Variable* param = function.declaration().parameters()[i];
         bool isOutParam = param->modifiers().fFlags & Modifiers::kOut_Flag;
 
         // If this argument can be inlined trivially (e.g. a swizzle, or a constant array index)...
         if (is_trivial_argument(*arguments[i])) {
             // ... and it's an `out` param, or it isn't written to within the inline function...
-            if (isOutParam || !Analysis::StatementWritesToVariable(*function.fBody, *param)) {
+            if (isOutParam || !Analysis::StatementWritesToVariable(*function.body(), *param)) {
                 // ... we don't need to copy it at all! We can just use the existing expression.
                 varMap[param] = arguments[i]->clone();
                 continue;
@@ -693,7 +693,7 @@
                                       param->modifiers(), &arguments[i]);
     }
 
-    const Block& body = function.fBody->as<Block>();
+    const Block& body = function.body()->as<Block>();
     auto inlineBlock = std::make_unique<Block>(offset, StatementArray{});
     inlineBlock->children().reserve(body.children().size());
     for (const std::unique_ptr<Statement>& stmt : body.children()) {
@@ -718,7 +718,7 @@
 
     // Copy back the values of `out` parameters into their real destinations.
     for (int i : argsToCopyBack) {
-        const Variable* p = function.fDeclaration.parameters()[i];
+        const Variable* p = function.declaration().parameters()[i];
         SkASSERT(varMap.find(p) != varMap.end());
         inlinedBody.children().push_back(
                 std::make_unique<ExpressionStatement>(std::make_unique<BinaryExpression>(
@@ -823,7 +823,7 @@
             case ProgramElement::Kind::kFunction: {
                 FunctionDefinition& funcDef = pe->as<FunctionDefinition>();
                 fEnclosingFunction = &funcDef;
-                this->visitStatement(&funcDef.fBody);
+                this->visitStatement(&funcDef.body());
                 break;
             }
             default:
@@ -1164,7 +1164,7 @@
 
         // Convert the function call to its inlined equivalent.
         InlinedCall inlinedCall = this->inlineCall(&funcCall, candidate.fSymbols,
-                                                   &candidate.fEnclosingFunction->fDeclaration);
+                                                   &candidate.fEnclosingFunction->declaration());
         if (inlinedCall.fInlinedBody) {
             // Ensure that the inlined body has a scope if it needs one.
             this->ensureScopedBlocks(inlinedCall.fInlinedBody.get(), candidate.fParentStmt->get());