Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Abstract_scope Class Reference

#include <scope.h>

Inheritance diagram for Abstract_scope:

Inheritance graph
[legend]
Collaboration diagram for Abstract_scope:

Collaboration graph
[legend]
List of all members.

Public Methods

 Abstract_scope (Abstract_scope *parent)
virtual ~Abstract_scope ()
virtual Symbol_pair lookup_here (std::string name, bool for_decl)=0
 Look up a symbol in this scope. More...

virtual Variable_symboladd_variable (Storage_class_specifier storage, Type type, Ptree *name, Ptree *init, Ptree *bitsize)=0
 Add a variable. More...

virtual Function_signatureadd_function_decl (Storage_class_specifier storage, Function_specifier_set fspec, Type type, const Symbol_name &sym_name)=0
 Declare a function. More...

virtual void add_function_implementation (Function_signature *, Block_scope *, Ptree *, Ptree *)=0
 Add function implementation. More...

virtual void add_symbol (std::string name, Symbol *)=0
 Add another symbol (nested type, ...). More...

virtual std::string get_unique_name (std::string name)=0
 Get unique naming prefix. More...

virtual Type get_this_type () const=0
 Get type of "*this". More...

Abstract_scope * get_parent () const
void set_parent (Abstract_scope *p)
virtual Symbol_pair lookup_unqualified (std::string name)
 Look up an unqualified symbol. More...

virtual bool is_constructor (Ptree *tree)
 Check whether /tree/ names a constructor. More...

virtual void process_pending ()
 Process pending tasks. More...

Abstract_scope * get_global_scope ()
 Get global scope. More...


Private Attributes

Abstract_scope * parent

Constructor & Destructor Documentation

Abstract_scope::Abstract_scope Abstract_scope *    parent [inline]
 

Definition at line 32 of file scope.h.

virtual Abstract_scope::~Abstract_scope   [inline, virtual]
 

Definition at line 33 of file scope.h.


Member Function Documentation

virtual Function_signature* Abstract_scope::add_function_decl Storage_class_specifier    storage,
Function_specifier_set    fspec,
Type    type,
const Symbol_name   sym_name
[pure virtual]
 

Declare a function.

Returns the declared signature.

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Template_defn_scope::add_function_decl(), Simple_declaration_reader::declare_variable(), and init_default_symbols().

virtual void Abstract_scope::add_function_implementation Function_signature  ,
Block_scope  ,
Ptree  ,
Ptree  
[pure virtual]
 

Add function implementation.

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Template_defn_scope::add_function_implementation(), Class_scope::add_function_implementation(), and Simple_declaration_reader::declare_variable().

virtual void Abstract_scope::add_symbol std::string    name,
Symbol  
[pure virtual]
 

Add another symbol (nested type, ...).

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Template_class_adder::add_class(), Default_class_adder::add_class(), Template_visitor::declare_class(), Typedef_declaration_reader::declare_variable(), Mangle::insert(), parse_enum(), Enum_symbol::process_value(), and Annotator::visit_namespacespec().

virtual Variable_symbol* Abstract_scope::add_variable Storage_class_specifier    storage,
Type    type,
Ptree   name,
Ptree   init,
Ptree   bitsize
[pure virtual]
 

Add a variable.

Returns variable symbol if this is a definition of a variable which must appear in output.

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Simple_declaration_reader::declare_variable().

Abstract_scope * Abstract_scope::get_global_scope  
 

Get global scope.

That is the scope without a parent.

Definition at line 50 of file scope.cc.

References get_parent().

Referenced by Template_visitor::declare_name(), Symbol_name::Symbol_name(), and Expr_annotator::visit_new().

Abstract_scope* Abstract_scope::get_parent   const [inline]
 

Definition at line 65 of file scope.h.

Referenced by Template_class_adder::add_class(), Template_defn_scope::add_function_decl(), Template_defn_scope::add_function_implementation(), Class_scope::add_function_implementation(), Template_visitor::declare_name(), Simple_declaration_reader::declare_variable(), get_global_scope(), Mangle::leave_scope(), Block_scope::lookup_here(), lookup_unqualified(), parse_class(), and Symbol_name::Symbol_name().

virtual Type Abstract_scope::get_this_type   const [pure virtual]
 

Get type of "*this".

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Expr_annotator::do_funcall(), Expr_annotator::visit_name(), and Expr_annotator::visit_this().

virtual std::string Abstract_scope::get_unique_name std::string    name [pure virtual]
 

Get unique naming prefix.

I hope to never need this function

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Mangle::enter_scope(), and Function_symbol::fill_in_mangled_names().

bool Abstract_scope::is_constructor Ptree   tree [virtual]
 

Check whether /tree/ names a constructor.

This is used by Symbol_name when parsing apart a name. Only Class_scope needs to override this.

Reimplemented in Class_scope.

Definition at line 32 of file scope.cc.

Referenced by Symbol_name::init_name().

virtual Symbol_pair Abstract_scope::lookup_here std::string    name,
bool    for_decl
[pure virtual]
 

Look up a symbol in this scope.

Parameters:
for_decl=true  this is a declaration, don't scan bases or using

Implemented in Block_scope, Class_scope, Namespace_scope, and Template_defn_scope.

Referenced by Namespace_scope::add_function_decl(), Template_visitor::declare_class(), Template_visitor::declare_name(), Typedef_declaration_reader::declare_variable(), Mangle::insert(), Symbol_name::lookup_for_decl(), Symbol_name::lookup_for_use(), Block_scope::lookup_here(), Symbol_name::lookup_symbol_in_scope(), lookup_unqualified(), parse_enum(), Annotator::visit_namespacespec(), and Expr_annotator::visit_new().

Symbol_pair Abstract_scope::lookup_unqualified std::string    name [virtual]
 

Look up an unqualified symbol.

That is, look up the symbol in this scope and all containing scopes.

Definition at line 12 of file scope.cc.

References get_parent(), and lookup_here().

Referenced by Template_visitor::declare_name(), Symbol_name::lookup_for_use(), Mangle::lookup_global_name(), Expr_annotator::visit_array(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

void Abstract_scope::process_pending   [virtual]
 

Process pending tasks.

This is called periodically by the main annotator code. This is needed to process definition of functions inside classes.

Reimplemented in Namespace_scope.

Definition at line 43 of file scope.cc.

Referenced by Annotator::process_pending().

void Abstract_scope::set_parent Abstract_scope *    p [inline]
 

Definition at line 66 of file scope.h.


Member Data Documentation

Abstract_scope* Abstract_scope::parent [private]
 

Definition at line 30 of file scope.h.


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 17:35:06 2003 for VFiasco Semantics Compiler by doxygen1.2.15