Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: src/sksl/ir/SkSLSymbolTable.h

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed CMake build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sksl/ir/SkSLSymbol.h ('k') | src/sksl/ir/SkSLSymbolTable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_SYMBOLTABLE
9 #define SKSL_SYMBOLTABLE
10
11 #include <memory>
12 #include <unordered_map>
13 #include "SkSLErrorReporter.h"
14 #include "SkSLSymbol.h"
15 #include "SkSLUnresolvedFunction.h"
16
17 namespace SkSL {
18
19 /**
20 * Maps identifiers to symbols. Functions, in particular, are mapped to either F unctionDeclaration
21 * or UnresolvedFunction depending on whether they are overloaded or not.
22 */
23 class SymbolTable {
24 public:
25 SymbolTable(ErrorReporter& errorReporter)
26 : fErrorReporter(errorReporter) {}
27
28 SymbolTable(std::shared_ptr<SymbolTable> parent, ErrorReporter& errorReporte r)
29 : fParent(parent)
30 , fErrorReporter(errorReporter) {}
31
32 std::shared_ptr<Symbol> operator[](const std::string& name);
33
34 void add(const std::string& name, std::shared_ptr<Symbol> symbol);
35
36 const std::shared_ptr<SymbolTable> fParent;
37
38 private:
39 static std::vector<std::shared_ptr<FunctionDeclaration>> GetFunctions(
40 const std::sha red_ptr<Symbol>& s);
41
42 std::unordered_map<std::string, std::shared_ptr<Symbol>> fSymbols;
43
44 ErrorReporter& fErrorReporter;
45 };
46
47 } // namespace
48
49 #endif
OLDNEW
« no previous file with comments | « src/sksl/ir/SkSLSymbol.h ('k') | src/sksl/ir/SkSLSymbolTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698