コード例 #1
0
ファイル: qsdebugger.cpp プロジェクト: juanjosepablos/eneboo
QString Debugger::varInfo(const QString &ident) const
{
  if (!eng)
    return QString();

  int dot = ident.find('.');
  if (dot < 0)
    dot = ident.length();
  QString sub = ident.mid(0, dot);
  QSObject obj;
  // resolve base
  if (sub == QString::fromLatin1("||Global||")) {
    obj = env()->globalObject();
  } else if (sub == QString::fromLatin1("||Activation||")) {
    obj = env()->currentScope();
  } else if (sub == QString::fromLatin1("this")) {
    obj = env()->thisValue();
  } else {
    obj = env()->resolveValue(ident);
    if (!obj.isValid())
      return QString();
  }
  // look up each part of a.b.c.
  while (dot < (int)ident.length()) {
    int olddot = dot;
    dot = ident.find('.', olddot + 1);
    if (dot < 0)
      dot = ident.length();
    sub = ident.mid(olddot + 1, dot - olddot - 1);
    obj = obj.get(sub);
    if (!obj.isDefined())
      break;
  }

  return sub + QString::fromLatin1("=") + obj.debugString();
}