#include <block.h>
Inheritance diagram for Block_scope:
Public Methods | |
Block_scope (Function_signature *fsig) | |
Block that implements a function. More... | |
Block_scope (Block_scope *parent, bool use_parent) | |
Sub-block inside another block. More... | |
~Block_scope () | |
Variable_symbol * | add_variable (Storage_class_specifier storage, Type type, Ptree *name, Ptree *init, Ptree *bitsize) |
Add a variable. More... | |
Function_signature * | add_function_decl (Storage_class_specifier storage, Function_specifier_set fspec, Type type, const Symbol_name &sym_name) |
Declare a function. More... | |
void | add_function_implementation (Function_signature *fsig, Block_scope *scope, Ptree *defn, Ptree *initializer) |
Add function implementation. More... | |
void | add_symbol (std::string name, Symbol *sym) |
Add another symbol (nested type, ...). More... | |
std::string | get_unique_name (std::string name) |
Get unique naming prefix. More... | |
Type | get_this_type () const |
Get type of "*this". More... | |
Function_signature * | get_function () const |
void | set_this_type (Type t) |
Symbol_pair | lookup_here (std::string name, bool for_decl) |
Look up a symbol in this scope. More... | |
Private Attributes | |
bool | use_parent |
if set, symbols declared in the parent are treated identical to those declared here. More... | |
std::string | fun_prefix |
std::string | block_prefix |
Abstract_scope * | nonblock |
Type | this_type |
Function_signature * | fsig |
|
Block that implements a function.
|
|
Sub-block inside another block.
|
|
|
|
Declare a function. Returns the declared signature. Implements Abstract_scope. Definition at line 91 of file block.cc. References compile_error(), Function_specifier_set, and Storage_class_specifier. |
|
Add function implementation.
Implements Abstract_scope. Definition at line 101 of file block.cc. References compile_error(). |
|
Add another symbol (nested type, ...).
Implements Abstract_scope. Definition at line 112 of file block.cc. References Symbol_table::add_symbol(), Symbol_table::get_instance(), and get_unique_name(). Referenced by add_variable(). |
|
Add a variable. Returns variable symbol if this is a definition of a variable which must appear in output. Implements Abstract_scope. Definition at line 48 of file block.cc. References Function_signature::add_parameter(), add_symbol(), compile_error(), fsig, Symbol_name::get_name(), Type::get_unqualified_type(), Symbol_name::is_qualified(), Symbol_name::is_template(), s_Auto, s_Extern, s_None, s_Parameter, s_Register, s_Static, Symbol::st_Defined, and Storage_class_specifier. Referenced by Simple_declaration_reader::declare_variable(). |
|
Definition at line 76 of file block.h. References fsig. Referenced by Annotator::visit_return(). |
|
Get type of "*this".
Implements Abstract_scope. Definition at line 137 of file block.cc. References this_type. |
|
Get unique naming prefix. I hope to never need this function Implements Abstract_scope. Definition at line 129 of file block.cc. References block_prefix, and Symbol_name::get_mangled_symbol_name(). Referenced by add_symbol(), and lookup_here(). |
|
Look up a symbol in this scope.
Implements Abstract_scope. Definition at line 153 of file block.cc. References Symbol_table::get_instance(), Abstract_scope::get_parent(), Symbol_table::get_symbol(), get_unique_name(), and Abstract_scope::lookup_here(). |
|
Definition at line 145 of file block.cc. References this_type. Referenced by process_function_body(). |
|
Definition at line 31 of file block.h. Referenced by get_unique_name(). |
|
Definition at line 34 of file block.h. Referenced by add_variable(), and get_function(). |
|
|
|
|
|
Definition at line 33 of file block.h. Referenced by get_this_type(), and set_this_type(). |
|
if set, symbols declared in the parent are treated identical to those declared here.
|