00001
00002
00003 #ifndef scope_h
00004 #define scope_h
00005
00006 #include <types.h>
00007 #include <ptree-core.h>
00008
00009 #include <string>
00010 #include <vector>
00011 #include "symbol_table.h"
00012 #include "type_rep.h"
00013
00014
00015
00016
00017
00018
00019 class Symbol_name;
00020 class Class_symbol;
00021 class Function_signature;
00022 class Block_scope;
00023 class Variable_symbol;
00029 class Abstract_scope : public LightObject {
00030 Abstract_scope* parent;
00031 public:
00032 Abstract_scope(Abstract_scope* parent) : parent(parent) { }
00033 virtual ~Abstract_scope() {}
00034
00037 virtual Symbol_pair lookup_here(std::string name, bool for_decl) = 0;
00038
00041 virtual Variable_symbol* add_variable(Storage_class_specifier storage,
00042 Type type,
00043 Ptree* name,
00044 Ptree* init,
00045 Ptree* bitsize) = 0;
00046
00048 virtual Function_signature* add_function_decl(Storage_class_specifier storage,
00049 Function_specifier_set fspec,
00050 Type type,
00051 const Symbol_name& sym_name) = 0;
00052
00054 virtual void add_function_implementation(Function_signature*, Block_scope*, Ptree*, Ptree*) = 0;
00055
00057 virtual void add_symbol(std::string name, Symbol*) = 0;
00058
00060 virtual std::string get_unique_name(std::string name) = 0;
00061
00063 virtual Type get_this_type() const = 0;
00064
00065 Abstract_scope* get_parent() const { return parent; }
00066 void set_parent(Abstract_scope* p) { parent = p; }
00067
00068 public:
00071 virtual Symbol_pair lookup_unqualified(std::string name);
00072
00076 virtual bool is_constructor(Ptree* tree);
00077
00081 virtual void process_pending();
00082
00084 Abstract_scope* get_global_scope();
00085 };
00086
00087 #endif // scope_h