• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 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 #ifndef SKSL_UNRESOLVEDFUNCTION
9 #define SKSL_UNRESOLVEDFUNCTION
10 
11 #include "src/sksl/ir/SkSLFunctionDeclaration.h"
12 
13 namespace SkSL {
14 
15 /**
16  * A symbol representing multiple functions with the same name.
17  */
18 class UnresolvedFunction final : public Symbol {
19 public:
20     inline static constexpr Kind kSymbolKind = Kind::kUnresolvedFunction;
21 
UnresolvedFunction(std::vector<const FunctionDeclaration * > funcs)22     UnresolvedFunction(std::vector<const FunctionDeclaration*> funcs)
23     : INHERITED(-1, kSymbolKind, funcs[0]->name())
24     , fFunctions(std::move(funcs)) {
25 #ifdef SK_DEBUG
26         SkASSERT(!this->functions().empty());
27         for (auto func : this->functions()) {
28             SkASSERT(func->name() == name());
29         }
30 #endif
31     }
32 
functions()33     const std::vector<const FunctionDeclaration*>& functions() const {
34         return fFunctions;
35     }
36 
description()37     String description() const override {
38         return String(this->name());
39     }
40 
41 private:
42     std::vector<const FunctionDeclaration*> fFunctions;
43 
44     using INHERITED = Symbol;
45 };
46 
47 }  // namespace SkSL
48 
49 #endif
50