added external value support to SkSL interpreter

Bug: skia:
Change-Id: I1806e1f6abaef322ecd3ba0d9bfaa9d7ca7a44c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212983
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index e7ff7e4..45065bc 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -296,6 +296,8 @@
                                 (std::unique_ptr<Expression>*) &fContext->fDefined_Expression,
                                 definitions);
             break;
+        case Expression::kExternalValue_Kind:
+            break;
         default:
             // not an lvalue, can't happen
             SkASSERT(false);
@@ -464,6 +466,8 @@
             const TernaryExpression& t = (TernaryExpression&) lvalue;
             return !t.fTest->hasSideEffects() && is_dead(*t.fIfTrue) && is_dead(*t.fIfFalse);
         }
+        case Expression::kExternalValue_Kind:
+            return false;
         default:
             ABORT("invalid lvalue: %s\n", lvalue.description().c_str());
     }
@@ -1232,6 +1236,14 @@
     }
 }
 
+void Compiler::registerExternalValue(ExternalValue* value) {
+    fIRGenerator->fRootSymbolTable->addWithoutOwnership(value->fName, value);
+}
+
+Symbol* Compiler::takeOwnership(std::unique_ptr<Symbol> symbol) {
+    return fIRGenerator->fRootSymbolTable->takeOwnership(std::move(symbol));
+}
+
 std::unique_ptr<Program> Compiler::convertProgram(Program::Kind kind, String text,
                                                   const Program::Settings& settings) {
     fErrorText = "";