00001
00002
00003 #ifndef block_h
00004 #define block_h
00005
00006 #include "scope.h"
00007 #include "type_rep.h"
00008
00009
00010
00011
00012
00013
00014 class PtreeBlock;
00015 class Ptree;
00016 class Function_signature;
00027 class Block_scope : public Abstract_scope {
00030 bool use_parent;
00031 std::string fun_prefix, block_prefix;
00032 Abstract_scope* nonblock;
00033 Type this_type;
00034 Function_signature* fsig;
00035
00036 public:
00039 Block_scope(Function_signature* fsig);
00040
00046 Block_scope(Block_scope* parent, bool use_parent);
00047
00048 ~Block_scope();
00049
00050 Variable_symbol* add_variable(Storage_class_specifier storage, Type type, Ptree* name, Ptree* init, Ptree* bitsize);
00051
00052 Function_signature* add_function_decl(Storage_class_specifier storage, Function_specifier_set fspec, Type type, const Symbol_name& sym_name);
00053
00054 void add_function_implementation(Function_signature* fsig, Block_scope* scope, Ptree* defn, Ptree* initializer);
00055
00056 void add_symbol(std::string name, Symbol* sym);
00057
00058 std::string get_unique_name(std::string name);
00059
00060 Type get_this_type() const;
00061
00062 Function_signature* get_function() const;
00063
00064 void set_this_type(Type t);
00065
00066 Symbol_pair lookup_here(std::string name, bool for_decl);
00067 };
00068
00069
00070
00071
00072
00073
00074
00075 inline Function_signature*
00076 Block_scope::get_function() const
00077 {
00078 return fsig;
00079 }
00080
00081 #endif // block_h