1 /* 2 * Copyright 2020 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 #ifndef SKSL_SYMBOLALIAS 9 #define SKSL_SYMBOLALIAS 10 11 #include "include/private/SkSLSymbol.h" 12 13 namespace SkSL { 14 15 /** 16 * A symbol representing a new name for an existing symbol. 17 */ 18 class SymbolAlias final : public Symbol { 19 public: 20 inline static constexpr Kind kSymbolKind = Kind::kSymbolAlias; 21 SymbolAlias(int line,skstd::string_view name,const Symbol * origSymbol)22 SymbolAlias(int line, skstd::string_view name, const Symbol* origSymbol) 23 : INHERITED(line, kSymbolKind, name) 24 , fOrigSymbol(origSymbol) {} 25 origSymbol()26 const Symbol* origSymbol() const { 27 return fOrigSymbol; 28 } 29 description()30 String description() const override { 31 return String(this->name()); 32 } 33 34 private: 35 const Symbol* fOrigSymbol; 36 37 using INHERITED = Symbol; 38 }; 39 40 } // namespace SkSL 41 42 #endif 43