Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkSL::Analysis::SymbolTableStackBuilder Class Reference

#include <SkSLAnalysis.h>

Public Member Functions

 SymbolTableStackBuilder (const Statement *stmt, std::vector< SymbolTable * > *stack)
 
 ~SymbolTableStackBuilder ()
 
bool foundSymbolTable ()
 

Detailed Description

Tracks the symbol table stack, in conjunction with a ProgramVisitor. Inside visitStatement, pass the current statement and a symbol-table vector to a SymbolTableStackBuilder and the symbol table stack will be maintained automatically.

Definition at line 263 of file SkSLAnalysis.h.

Constructor & Destructor Documentation

◆ SymbolTableStackBuilder()

SkSL::Analysis::SymbolTableStackBuilder::SymbolTableStackBuilder ( const Statement stmt,
std::vector< SymbolTable * > *  stack 
)

Definition at line 22 of file SkSLSymbolTableStackBuilder.cpp.

23 {
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}

◆ ~SymbolTableStackBuilder()

SkSL::Analysis::SymbolTableStackBuilder::~SymbolTableStackBuilder ( )

Definition at line 46 of file SkSLSymbolTableStackBuilder.cpp.

46 {
47 if (fStackToPop) {
48 fStackToPop->pop_back();
49 }
50}

Member Function Documentation

◆ foundSymbolTable()

bool SkSL::Analysis::SymbolTableStackBuilder::foundSymbolTable ( )
inline

Definition at line 272 of file SkSLAnalysis.h.

272 {
273 return fStackToPop != nullptr;
274 }

The documentation for this class was generated from the following files: