Flutter Engine
The Flutter Engine
SkSLSymbolTableStackBuilder.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 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
13
14#include <vector>
15
16namespace SkSL {
17
18class SymbolTable;
19
20namespace Analysis {
21
23 std::vector<SymbolTable*>* stack) {
24 if (stmt) {
25 switch (stmt->kind()) {
26 case Statement::Kind::kBlock:
27 if (SymbolTable* symbols = stmt->as<Block>().symbolTable()) {
28 stack->push_back(symbols);
29 fStackToPop = stack;
30 }
31 break;
32
33 case Statement::Kind::kFor:
34 if (SymbolTable* symbols = stmt->as<ForStatement>().symbols()) {
35 stack->push_back(symbols);
36 fStackToPop = stack;
37 }
38 break;
39
40 default:
41 break;
42 }
43 }
44}
45
47 if (fStackToPop) {
48 fStackToPop->pop_back();
49 }
50}
51
52} // namespace Analysis
53} // namespace SkSL
SymbolTableStackBuilder(const Statement *stmt, std::vector< SymbolTable * > *stack)
SymbolTable * symbolTable() const
Definition: SkSLBlock.h:91
SymbolTable * symbols() const
const T & as() const
Definition: SkSLIRNode.h:133
Kind kind() const
Definition: SkSLStatement.h:28