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

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

Issue 2300023002: minor SkSL changes to avoid compiler errors in Chromium (Closed)
Patch Set: Created 4 years, 3 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/SkSLFieldAccess.h ('k') | src/sksl/ir/SkSLType.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSLSymbolTable.h" 8 #include "SkSLSymbolTable.h"
9 #include "SkSLUnresolvedFunction.h" 9 #include "SkSLUnresolvedFunction.h"
10 10
11 namespace SkSL { 11 namespace SkSL {
12 12
13 std::vector<const FunctionDeclaration*> SymbolTable::GetFunctions(const Symbol& s) { 13 std::vector<const FunctionDeclaration*> SymbolTable::GetFunctions(const Symbol& s) {
14 switch (s.fKind) { 14 switch (s.fKind) {
15 case Symbol::kFunctionDeclaration_Kind: 15 case Symbol::kFunctionDeclaration_Kind:
16 return { &((FunctionDeclaration&) s) }; 16 return { &((FunctionDeclaration&) s) };
17 case Symbol::kUnresolvedFunction_Kind: 17 case Symbol::kUnresolvedFunction_Kind:
18 return ((UnresolvedFunction&) s).fFunctions; 18 return ((UnresolvedFunction&) s).fFunctions;
19 default: 19 default:
20 return { }; 20 return std::vector<const FunctionDeclaration*>();
21 } 21 }
22 } 22 }
23 23
24 const Symbol* SymbolTable::operator[](const std::string& name) { 24 const Symbol* SymbolTable::operator[](const std::string& name) {
25 const auto& entry = fSymbols.find(name); 25 const auto& entry = fSymbols.find(name);
26 if (entry == fSymbols.end()) { 26 if (entry == fSymbols.end()) {
27 if (fParent) { 27 if (fParent) {
28 return (*fParent)[name]; 28 return (*fParent)[name];
29 } 29 }
30 return nullptr; 30 return nullptr;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 UnresolvedFunction* u = new UnresolvedFunction(std::move(functions)) ; 91 UnresolvedFunction* u = new UnresolvedFunction(std::move(functions)) ;
92 fSymbols[name] = u; 92 fSymbols[name] = u;
93 this->takeOwnership(u); 93 this->takeOwnership(u);
94 } 94 }
95 } else { 95 } else {
96 fErrorReporter.error(symbol->fPosition, "symbol '" + name + "' was alrea dy defined"); 96 fErrorReporter.error(symbol->fPosition, "symbol '" + name + "' was alrea dy defined");
97 } 97 }
98 } 98 }
99 99
100 } // namespace 100 } // namespace
OLDNEW
« no previous file with comments | « src/sksl/ir/SkSLFieldAccess.h ('k') | src/sksl/ir/SkSLType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698