Debian Codegraph @

src/sksl/ir/SkSLVariableReference.cpp

raw
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
14 VariableReference::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
21 std::string VariableReference::description(OperatorPrecedence) const {
22 return std::string(this->variable()->name());
23 }
24
25 void VariableReference::setRefKind(RefKind refKind) {
26 fRefKind = refKind;
27 }
28
29 void VariableReference::setVariable(const Variable* variable) {
30 fVariable = variable;
31 }
32
33 } // namespace SkSL