Blender V5.3
bsl::SymbolScope Struct Reference

#include <symbol_scope.hh>

Inherits bsl::Symbol.

Inherited by bsl::SymbolClass, and bsl::SymbolFunction.

Public Types

enum  Type {
  FUNCTION , CLASS , NAMESPACE , LOCAL ,
  ROOT
}

Public Member Functions

 SymbolScope (ast::LocalScope decl)
 SymbolScope (SymbolScope *parent, Token tok, const string &id, Type type)
 SymbolScope (SymbolScope *parent, ast::LocalScope decl)
 SymbolScope (SymbolScope *parent, ast::Id id, Type type)
SymbolVariable * lookup_variable (const SymbolTable &table, ast::IdQualified id) const
Result< SymbolFunction * > lookup_function (const SymbolTable &table, ast::IdQualified id, optional< SourceLocation > loc=nullopt) const
template<typename ArgOrParamList>
Result< SymbolFunction * > lookup_function (const SymbolTable &table, ast::IdQualified id, ArgOrParamList params, const SymbolScope &arguments_scope, optional< SourceLocation > loc=nullopt) const
Result< SymbolClass * > lookup_class (const SymbolTable &table, ast::IdQualified id, optional< SourceLocation > loc=nullopt) const
Result< SymbolClass * > lookup_class (const SymbolTable &table, ast::Id id, ast::Id last, optional< SourceLocation > loc=nullopt) const
SymbolVariable * lookup_variable (string id) const
SymbolFunction * lookup_function (string id) const
SymbolClass * lookup_class (string id) const
SymbolFunction * lookup_function_base (const SymbolTable &table, ast::IdQualified id) const
SymbolClass * lookup_class_base (const SymbolTable &table, ast::IdQualified id) const
std::pair< ast::FuncForwardDecl, SymbolFunction * > lookup_function_forward_decl (ast::FuncDecl decl) const
void print () const
const SymbolScope * root_scope () const
SymbolScope * root_scope ()
SymbolClass * as_class ()
SymbolFunction * as_function ()
const SymbolFunction * as_function () const
SymbolFunction * parent_function ()
const SymbolFunction * parent_function () const
bool function_emplace (SymbolFunction *fn, bool builtin=false)
bool variable_emplace (string id, SymbolVariable *var)
bool variable_emplace (SymbolVariable *var)
vector< SymbolVariable * > non_static_variables_in_declaration_order () const
SymbolScope * child_scope (int n)

Public Attributes

friend SymbolParser
unordered_map< string, SymbolScope * > scopes
SymbolMap< SymbolVariable > variables
SymbolMap< SymbolFunction > functions
SymbolMap< SymbolClass > classes
vector< std::pair< ast::FuncForwardDecl, SymbolFunction * > > function_prototypes
optional< SourceLocation > poi
enum bsl::SymbolScope::Type type = ROOT
Public Attributes inherited from bsl::Symbol
string identifier
string original
SourceLocation loc
SymbolScope * parent = nullptr

Detailed Description

Container for symbol visible inside a namespace scope.

  • Scope can be anonymous (automatic identifier).
  • Symbols can be referenced by multiple scopes (e.g. enum, using).

Definition at line 62 of file symbol_scope.hh.

Member Enumeration Documentation

◆ Type

Enumerator
FUNCTION 
CLASS 
NAMESPACE 
LOCAL 
ROOT 

Definition at line 90 of file symbol_scope.hh.

Constructor & Destructor Documentation

◆ SymbolScope() [1/4]

◆ SymbolScope() [2/4]

bsl::SymbolScope::SymbolScope ( SymbolScope * parent,
Token tok,
const string & id,
Type type )
inline

Definition at line 95 of file symbol_scope.hh.

References bsl::Symbol::parent, SymbolScope(), and type.

◆ SymbolScope() [3/4]

bsl::SymbolScope::SymbolScope ( SymbolScope * parent,
ast::LocalScope decl )
inline

Definition at line 100 of file symbol_scope.hh.

References LOCAL, bsl::Symbol::parent, and SymbolScope().

◆ SymbolScope() [4/4]

bsl::SymbolScope::SymbolScope ( SymbolScope * parent,
ast::Id id,
Type type )
inline

Definition at line 105 of file symbol_scope.hh.

References bsl::Symbol::parent, str, SymbolScope(), and type.

Member Function Documentation

◆ as_class()

◆ as_function() [1/2]

SymbolFunction * bsl::SymbolScope::as_function ( )

Definition at line 393 of file symbol_scope.cc.

References FUNCTION, and type.

◆ as_function() [2/2]

const SymbolFunction * bsl::SymbolScope::as_function ( ) const

Definition at line 397 of file symbol_scope.cc.

References FUNCTION, and type.

◆ child_scope()

SymbolScope * bsl::SymbolScope::child_scope ( int n)

Definition at line 478 of file symbol_scope.cc.

References scopes, SymbolScope(), and to_string().

◆ function_emplace()

bool bsl::SymbolScope::function_emplace ( SymbolFunction * fn,
bool builtin = false )

Definition at line 419 of file symbol_scope.cc.

References functions, blender::result, and scopes.

Referenced by bsl::SymbolParser::parse_func_forward_decl().

◆ lookup_class() [1/3]

Result< SymbolClass * > bsl::SymbolScope::lookup_class ( const SymbolTable & table,
ast::Id id,
ast::Id last,
optional< SourceLocation > loc = nullopt ) const

◆ lookup_class() [2/3]

◆ lookup_class() [3/3]

SymbolClass * bsl::SymbolScope::lookup_class ( string id) const

Definition at line 370 of file symbol_scope.cc.

References classes.

◆ lookup_class_base()

SymbolClass * bsl::SymbolScope::lookup_class_base ( const SymbolTable & table,
ast::IdQualified id ) const

◆ lookup_function() [1/3]

template<typename ArgOrParamList>
Result< SymbolFunction * > bsl::SymbolScope::lookup_function ( const SymbolTable & table,
ast::IdQualified id,
ArgOrParamList params,
const SymbolScope & arguments_scope,
optional< SourceLocation > loc = nullopt ) const

◆ lookup_function() [2/3]

◆ lookup_function() [3/3]

SymbolFunction * bsl::SymbolScope::lookup_function ( string id) const

Definition at line 376 of file symbol_scope.cc.

References functions.

◆ lookup_function_base()

SymbolFunction * bsl::SymbolScope::lookup_function_base ( const SymbolTable & table,
ast::IdQualified id ) const

◆ lookup_function_forward_decl()

◆ lookup_variable() [1/2]

SymbolVariable * bsl::SymbolScope::lookup_variable ( const SymbolTable & table,
ast::IdQualified id ) const

◆ lookup_variable() [2/2]

SymbolVariable * bsl::SymbolScope::lookup_variable ( string id) const

Definition at line 382 of file symbol_scope.cc.

References variables.

◆ non_static_variables_in_declaration_order()

vector< SymbolVariable * > bsl::SymbolScope::non_static_variables_in_declaration_order ( ) const

◆ parent_function() [1/2]

SymbolFunction * bsl::SymbolScope::parent_function ( )

Definition at line 402 of file symbol_scope.cc.

References FUNCTION, and SymbolScope().

◆ parent_function() [2/2]

const SymbolFunction * bsl::SymbolScope::parent_function ( ) const

Definition at line 410 of file symbol_scope.cc.

References FUNCTION, and SymbolScope().

◆ print()

void bsl::SymbolScope::print ( ) const

◆ root_scope() [1/2]

SymbolScope * bsl::SymbolScope::root_scope ( )

Definition at line 183 of file symbol_scope.cc.

References bsl::Symbol::parent, and SymbolScope().

◆ root_scope() [2/2]

const SymbolScope * bsl::SymbolScope::root_scope ( ) const

Definition at line 174 of file symbol_scope.cc.

References bsl::Symbol::parent, and SymbolScope().

◆ variable_emplace() [1/2]

◆ variable_emplace() [2/2]

bool bsl::SymbolScope::variable_emplace ( SymbolVariable * var)

Definition at line 457 of file symbol_scope.cc.

References bsl::Symbol::identifier, and variables.

Member Data Documentation

◆ classes

◆ function_prototypes

vector<std::pair<ast::FuncForwardDecl, SymbolFunction *> > bsl::SymbolScope::function_prototypes

◆ functions

◆ poi

optional<SourceLocation> bsl::SymbolScope::poi

Definition at line 87 of file symbol_scope.hh.

Referenced by bsl::SymbolParser::parse_func_forward_decl().

◆ scopes

◆ SymbolParser

friend bsl::SymbolScope::SymbolParser

Definition at line 63 of file symbol_scope.hh.

◆ type

◆ variables


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