1 /* 2 * Copyright 2018 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/sksl/ir/SkSLVariableReference.h" 9 10 #include "src/sksl/ir/SkSLVariable.h" 11 12 namespace SkSL { 13 VariableReference(Position pos,const Variable * variable,RefKind refKind)14VariableReference::VariableReference(Position pos, const Variable* variable, RefKind refKind) 15 : INHERITED(pos, kIRNodeKind, &variable->type()) 16 , fVariable(variable) 17 , fRefKind(refKind) { 18 SkASSERT(this->variable()); 19 } 20 description(OperatorPrecedence) const21std::string VariableReference::description(OperatorPrecedence) const { 22 return std::string(this->variable()->name()); 23 } 24 setRefKind(RefKind refKind)25void VariableReference::setRefKind(RefKind refKind) { 26 fRefKind = refKind; 27 } 28 setVariable(const Variable * variable)29void VariableReference::setVariable(const Variable* variable) { 30 fVariable = variable; 31 } 32 33 } // namespace SkSL 34