| 29 | } |
| 30 | |
| 31 | bool cSymbolTable::AddVariable(const cString& name, const sASTypeInfo& type, int& var_id) |
| 32 | { |
| 33 | bool found = LookupVariable(name, var_id); |
| 34 | int shadow = var_id; |
| 35 | if (found && m_sym_tbl[var_id]->scope == m_scope && !m_sym_tbl[var_id]->deactivate) return false; |
| 36 | |
| 37 | var_id = m_sym_tbl.GetSize(); |
| 38 | m_sym_tbl.Push(new sSymbolEntry(name, type, m_scope)); |
| 39 | |
| 40 | if (found) { |
| 41 | m_sym_dict.SetValue(name, var_id); |
| 42 | m_sym_tbl[var_id]->shadow = shadow; |
| 43 | } else { |
| 44 | m_sym_dict.Add(name, var_id); |
| 45 | } |
| 46 | |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | bool cSymbolTable::AddFunction(const cString& name, const sASTypeInfo& type, int& fun_id) |
| 51 | { |
no test coverage detected