예제 #1
0
ClassScopeRawPtr BlockScope::findExactClass(ClassScopeRawPtr cls) {
  if (ClassScopeRawPtr currentCls = getContainingClass()) {
    if (cls->isNamed(currentCls->getOriginalName())) {
      return currentCls;
    }
  }
  return ClassScopeRawPtr();
}
예제 #2
0
ClassScopePtr StaticClassName::resolveClass() {
  m_present = false;
  m_unknown = true;
  if (m_class) return ClassScopePtr();
  BlockScopeRawPtr scope = originalScope(this);
  if (m_self) {
    if (ClassScopePtr self = scope->getContainingClass()) {
      m_origClassName = self->getOriginalName();
      m_present = true;
      m_unknown = false;
      return self;
    }
  } else if (m_parent) {
    if (ClassScopePtr self = scope->getContainingClass()) {
      if (!self->getOriginalParent().empty()) {
        m_origClassName = self->getOriginalParent();
        m_present = true;
      }
    } else {
      m_parent = false;
    }
  }
  ClassScopePtr cls = scope->getContainingProgram()->findClass(m_origClassName);
  if (cls) {
    m_unknown = false;
    if (cls->isVolatile()) {
      ClassScopeRawPtr c = scope->getContainingClass();
      if (c && c->isNamed(m_origClassName)) {
        c.reset();
      }
      m_present = c.get() != nullptr;
      if (cls->isRedeclaring()) {
        cls = c;
        if (!m_present) m_redeclared = true;
      }
    } else {
      m_present = true;
    }
  }
  return cls;
}