Moved SkSL type into IRNode, now accessed via a method

This change doesn't accomplish anything by itself, but is a necessary
prerequisite for followup changes to node handling. Eventually all data
is going to be stored within IRNode itself, and the subclasses will not
add any fields; this is just the first step in that process.

Change-Id: If2bea4c62bd8f680e9d9f39248bb9679332b245b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315867
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index 459362f..4270261 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -237,7 +237,7 @@
                                                       expr(b.fLeft),
                                                       b.fOperator,
                                                       expr(b.fRight),
-                                                      b.fType);
+                                                      &b.type());
         }
         case Expression::Kind::kBoolLiteral:
         case Expression::Kind::kIntLiteral:
@@ -246,12 +246,12 @@
             return expression.clone();
         case Expression::Kind::kConstructor: {
             const Constructor& constructor = expression.as<Constructor>();
-            return std::make_unique<Constructor>(offset, constructor.fType,
+            return std::make_unique<Constructor>(offset, &constructor.type(),
                                                  argList(constructor.fArguments));
         }
         case Expression::Kind::kExternalFunctionCall: {
             const ExternalFunctionCall& externalCall = expression.as<ExternalFunctionCall>();
-            return std::make_unique<ExternalFunctionCall>(offset, externalCall.fType,
+            return std::make_unique<ExternalFunctionCall>(offset, &externalCall.type(),
                                                           externalCall.fFunction,
                                                           argList(externalCall.fArguments));
         }
@@ -263,7 +263,7 @@
         }
         case Expression::Kind::kFunctionCall: {
             const FunctionCall& funcCall = expression.as<FunctionCall>();
-            return std::make_unique<FunctionCall>(offset, funcCall.fType, funcCall.fFunction,
+            return std::make_unique<FunctionCall>(offset, &funcCall.type(), funcCall.fFunction,
                                                   argList(funcCall.fArguments));
         }
         case Expression::Kind::kFunctionReference:
@@ -376,7 +376,7 @@
                                                                 VariableReference::kWrite_RefKind),
                             Token::Kind::TK_EQ,
                             expr(r.fExpression),
-                            returnVar->fType));
+                            &returnVar->type()));
                 if (haveEarlyReturns) {
                     std::vector<std::unique_ptr<Statement>> block;
                     block.push_back(std::move(assignment));
@@ -416,12 +416,12 @@
             // its symbols
             std::unique_ptr<String> name(new String(old->fName));
             const String* namePtr = symbolTableForStatement->takeOwnershipOfString(std::move(name));
-            const Type* typePtr = copy_if_needed(&old->fType, *symbolTableForStatement);
+            const Type* typePtr = copy_if_needed(&old->type(), *symbolTableForStatement);
             const Variable* clone = symbolTableForStatement->takeOwnershipOfSymbol(
                     std::make_unique<Variable>(offset,
                                                old->fModifiers,
                                                namePtr->c_str(),
-                                               *typePtr,
+                                               typePtr,
                                                old->fStorage,
                                                initialValue.get()));
             (*varMap)[old] = clone;
@@ -521,7 +521,7 @@
         StringFragment nameFrag{namePtr->c_str(), namePtr->length()};
 
         // Add our new variable to the symbol table.
-        auto newVar = std::make_unique<Variable>(/*offset=*/-1, Modifiers(), nameFrag, *type,
+        auto newVar = std::make_unique<Variable>(/*offset=*/-1, Modifiers(), nameFrag, type,
                                                  Variable::kLocal_Storage, initialValue->get());
         const Variable* variableSymbol = symbolTableForCall->add(nameFrag, std::move(newVar));
 
@@ -569,8 +569,8 @@
             }
         }
 
-        varMap[param] = makeInlineVar(String(param->fName), &arguments[i]->fType, param->fModifiers,
-                                      &arguments[i]);
+        varMap[param] = makeInlineVar(String(param->fName), &arguments[i]->type(),
+                                      param->fModifiers, &arguments[i]);
     }
 
     const Block& body = function.fBody->as<Block>();
@@ -612,7 +612,7 @@
                                                        arguments[i]->clone(),
                                                        Token::Kind::TK_EQ,
                                                        std::move(varRef),
-                                                       arguments[i]->fType)));
+                                                       &arguments[i]->type())));
         }
     }