TypePtr ParameterExpression::getTypeSpecForClass(AnalysisResultPtr ar, bool forInference) { TypePtr ret; if (forInference) { ClassScopePtr cls = ar->findClass(m_type); if (!cls || cls->isRedeclaring() || cls->derivedByDynamic()) { if (!cls && getScope()->isFirstPass() && !ar->isTypeAliasName(m_type)) { ConstructPtr self = shared_from_this(); Compiler::Error(Compiler::UnknownClass, self); } ret = Type::Variant; } if (cls) { // Classes must be redeclaring if there are also type aliases // with the same name. assert(!ar->isTypeAliasName(m_type) || cls->isRedeclaring()); } } if (!ret) { ret = ar->isTypeAliasName(m_type) || !Option::WholeProgram ? Type::Variant : Type::CreateObjectType(m_type); } always_assert(ret); return ret; }