OLD | NEW |
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 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 functions.push_back((const FunctionDeclaration*) symbol); | 90 functions.push_back((const FunctionDeclaration*) symbol); |
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 |
| 101 void SymbolTable::markAllFunctionsBuiltin() { |
| 102 for (const auto& pair : fSymbols) { |
| 103 switch (pair.second->fKind) { |
| 104 case Symbol::kFunctionDeclaration_Kind: |
| 105 ((FunctionDeclaration&) *pair.second).fBuiltin = true; |
| 106 break; |
| 107 case Symbol::kUnresolvedFunction_Kind: |
| 108 for (auto& f : ((UnresolvedFunction&) *pair.second).fFunctions)
{ |
| 109 ((FunctionDeclaration*) f)->fBuiltin = true; |
| 110 } |
| 111 break; |
| 112 default: |
| 113 break; |
| 114 } |
| 115 } |
| 116 } |
| 117 |
100 } // namespace | 118 } // namespace |
OLD | NEW |