00001 #define TRACE_NAME "SimpleVariableScope"
00002 #include "SimpleVariableScope.h"
00003
00004
00005
00007
00008
00009
00011
00012 SimpleVariableScope::SimpleVariableScope()
00013 {
00014
00015 }
00016
00017 #if 0
00018
00019 SimpleVariableScope::SimpleVariableScope(const SimpleVariableScope& other)
00020 {
00021 NOT_IMPLEMENTED
00022 }
00023
00024 const SimpleVariableScope& SimpleVariableScope::operator=(const SimpleVariableScope& other)
00025 {
00026 NOT_IMPLEMENTED
00027 }
00028
00029 bool SimpleVariableScope::operator==(const SimpleVariableScope& other) const
00030 {
00031 NOT_IMPLEMENTED
00032 }
00033
00034 bool SimpleVariableScope::operator<(const SimpleVariableScope& other) const
00035 {
00036 NOT_IMPLEMENTED
00037 }
00038
00039 size_t SimpleVariableScope::hash() const
00040 {
00041 NOT_IMPLEMENTED
00042 }
00043
00044
00045 #endif
00046
00047
00048 std::ostream& SimpleVariableScope::print_to(std::ostream& stream) const
00049 {
00050 stream << "SymTab#" << table.getTableNumber();
00051 return stream;
00052 }
00053
00054
00055 SimpleVariableScope::~SimpleVariableScope()
00056 {
00057
00058 }
00059
00061
00062
00063
00065
00066
00067 size_t SimpleVariableScope::getNumVars() const
00068 {
00069 return table.size();
00070 }
00071
00072 Symbol SimpleVariableScope::getVar(size_t index) const
00073 {
00074 return Symbol(const_cast<SymbolTable*>(&table), index);
00075 }
00076
00077 Symbol SimpleVariableScope::getVar(const char* name, bool* added_ptr)
00078 {
00079 return Symbol(&table,
00080 table.lookupOrAdd(Symbol::VARIABLE, name, added_ptr));
00081 }
00082
00083 size_t SimpleVariableScope::getVarIndex(const char* name)
00084 {
00085 return table.lookupOrAdd(Symbol::VARIABLE, name);
00086 }
00087
00088 bool SimpleVariableScope::contains(const Triple& t) const
00089 {
00090 for (size_t i=0; i<3; i++) {
00091 Symbol s= t.get(i);
00092 if (s.isVar() && &s.table() != &table) return false;
00093 }
00094 return true;
00095 }
00096
00098
00099
00100
00102
00103
00104
00105
00106
00107
00108 #undef TRACE_NAME