示例#1
0
Variable::Variable(string id, Expression* expression)
{
  Symbol_table *table = Symbol_table::instance();
  m_id = id;
  m_variable = "";
  m_expression = expression;
  m_type = m_expression->get_type();
  Symbol* symbol = table->lookup(m_id);
  m_symbol = symbol;
}
示例#2
0
Variable::Variable(string id1, string id2)
{
  Symbol_table *table = Symbol_table::instance();
  m_id = id1;
  m_expression = NULL;
  Symbol* symbol = table->lookup(m_id);
  m_symbol = symbol;
  m_variable = id2;
  Gpl_type type;
  Status status = (m_symbol->get_game_object_value())->get_member_variable_type(id2, type);
   if(status == MEMBER_NOT_DECLARED)
    {
      Error::error(Error::UNDECLARED_MEMBER, m_id, m_variable);
      m_type = INT;
    }
  else
    m_type = type;
}