MCPcopy Create free account
hub / github.com/devosoft/avida / AddVariable

Method AddVariable

avida-core/source/script/cSymbolTable.cc:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31bool 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
50bool cSymbolTable::AddFunction(const cString& name, const sASTypeInfo& type, int& fun_id)
51{

Callers 1

Calls 4

GetSizeMethod · 0.45
PushMethod · 0.45
SetValueMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected