1 /*
2  * Copyright 2021 Google LLC.
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/SkSLVariable.h"
9 
10 #include "src/sksl/ir/SkSLVarDeclarations.h"
11 
12 namespace SkSL {
13 
~Variable()14 Variable::~Variable() {
15     // Unhook this Variable from its associated VarDeclaration, since we're being deleted.
16     if (fDeclaration) {
17         fDeclaration->setVar(nullptr);
18     }
19 }
20 
initialValue() const21 const Expression* Variable::initialValue() const {
22     return fDeclaration ? fDeclaration->value().get() : nullptr;
23 }
24 
25 } // namespace SkSL
26