forked from qt-creator/qt-creator
		
	Get rid of deprected method ResolveExpression::resolveBaseExpression().
This commit is contained in:
		@@ -625,123 +625,6 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
QList<LookupItem>
 | 
			
		||||
ResolveExpression::resolveBaseExpression(const QList<LookupItem> &baseResults, int accessOp,
 | 
			
		||||
                                         bool *replacedDotOperator) const
 | 
			
		||||
{
 | 
			
		||||
    QList<LookupItem> results;
 | 
			
		||||
 | 
			
		||||
    if (baseResults.isEmpty())
 | 
			
		||||
        return results;
 | 
			
		||||
 | 
			
		||||
    LookupItem result = baseResults.first();
 | 
			
		||||
    FullySpecifiedType ty = result.type().simplified();
 | 
			
		||||
    Scope *scope = result.scope();
 | 
			
		||||
 | 
			
		||||
    if (Function *funTy = ty->asFunctionType()) {
 | 
			
		||||
        if (funTy->isAmbiguous())
 | 
			
		||||
            ty = funTy->returnType().simplified();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (accessOp == T_ARROW)  {
 | 
			
		||||
        if (NamedType *namedTy = ty->asNamedType()) {
 | 
			
		||||
            const Name *arrowAccessOp = control()->operatorNameId(OperatorNameId::ArrowOp);
 | 
			
		||||
 | 
			
		||||
            foreach (Symbol *declaration, _context.lookup(namedTy->name(), result.scope())) {
 | 
			
		||||
                if (PointerType *ptrTy = declaration->type()->asPointerType()) {
 | 
			
		||||
                    FullySpecifiedType elementTy = ptrTy->elementType().simplified();
 | 
			
		||||
 | 
			
		||||
                    if (elementTy->isNamedType() || elementTy->isClassType()) {
 | 
			
		||||
                        LookupItem item;
 | 
			
		||||
                        item.setType(elementTy);
 | 
			
		||||
                        item.setDeclaration(declaration);
 | 
			
		||||
                        results.append(item);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                } else if (const NamedType *nt = declaration->type()->asNamedType()) {
 | 
			
		||||
#warning fix this code
 | 
			
		||||
                    qWarning() << Q_FUNC_INFO << __LINE__;
 | 
			
		||||
                    Symbol *declaration = _context.lookup(nt->name(), result.scope()).first();
 | 
			
		||||
 | 
			
		||||
                    if (PointerType *ptrTy = declaration->type()->asPointerType()) {
 | 
			
		||||
                        FullySpecifiedType elementTy = ptrTy->elementType().simplified();
 | 
			
		||||
 | 
			
		||||
                        if (elementTy->isNamedType() || elementTy->isClassType()) {
 | 
			
		||||
                            LookupItem item;
 | 
			
		||||
                            item.setType(elementTy);
 | 
			
		||||
                            item.setDeclaration(declaration);
 | 
			
		||||
                            results.append(item);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (ClassOrNamespace *b = _context.classOrNamespace(namedTy->name(), result.scope())) {
 | 
			
		||||
                foreach (Symbol *overload, b->find(arrowAccessOp)) {
 | 
			
		||||
                    if (Function *funTy = overload->type()->asFunctionType()) {
 | 
			
		||||
                        FullySpecifiedType f = instantiate(namedTy->name(), funTy);
 | 
			
		||||
                        FullySpecifiedType retTy = f->asFunctionType()->returnType().simplified();
 | 
			
		||||
 | 
			
		||||
                        if (PointerType *ptrTy = retTy->asPointerType()) {
 | 
			
		||||
                            FullySpecifiedType elementTy = ptrTy->elementType().simplified();
 | 
			
		||||
 | 
			
		||||
                            LookupItem item;
 | 
			
		||||
                            item.setType(elementTy);
 | 
			
		||||
                            item.setDeclaration(overload);
 | 
			
		||||
                            results.append(item);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        } else if (PointerType *ptrTy = ty->asPointerType()) {
 | 
			
		||||
            FullySpecifiedType elementTy = ptrTy->elementType().simplified();
 | 
			
		||||
 | 
			
		||||
            if (elementTy->isNamedType() || elementTy->isClassType()) {
 | 
			
		||||
                LookupItem item;
 | 
			
		||||
                item.setType(elementTy);
 | 
			
		||||
                item.setScope(scope);
 | 
			
		||||
                results.append(item);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else if (accessOp == T_DOT) {
 | 
			
		||||
        if (replacedDotOperator) {
 | 
			
		||||
            if (PointerType *ptrTy = ty->asPointerType()) {
 | 
			
		||||
                *replacedDotOperator = true;
 | 
			
		||||
                ty = ptrTy->elementType().simplified();
 | 
			
		||||
            } else if (ArrayType *arrTy = ty->asArrayType()) {
 | 
			
		||||
                *replacedDotOperator = true;
 | 
			
		||||
                ty = arrTy->elementType().simplified();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (NamedType *namedTy = ty->asNamedType()) {
 | 
			
		||||
            if (ClassOrNamespace *binding = _context.classOrNamespace(namedTy->name(), result.scope())) {
 | 
			
		||||
                foreach (Symbol *s, binding->symbols()) {
 | 
			
		||||
                    LookupItem item;
 | 
			
		||||
                    item.setType(s->type());
 | 
			
		||||
                    item.setDeclaration(s);
 | 
			
		||||
                    results.append(item);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        } else if (Function *fun = ty->asFunctionType()) {
 | 
			
		||||
            Scope *funScope = fun->scope();
 | 
			
		||||
 | 
			
		||||
            if (funScope && (funScope->isBlockScope() || funScope->isNamespaceScope())) {
 | 
			
		||||
                FullySpecifiedType retTy = fun->returnType().simplified();
 | 
			
		||||
                LookupItem item;
 | 
			
		||||
                item.setType(retTy);
 | 
			
		||||
                item.setDeclaration(fun);
 | 
			
		||||
                results.append(item);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return removeDuplicates(results);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FullySpecifiedType ResolveExpression::instantiate(const Name *className, Symbol *candidate) const
 | 
			
		||||
{
 | 
			
		||||
    return GenTemplateInstance::instantiate(className, candidate, _context.control());
 | 
			
		||||
 
 | 
			
		||||
@@ -51,10 +51,6 @@ public:
 | 
			
		||||
                                     int accessOp,
 | 
			
		||||
                                     bool *replacedDotOperator = 0) const;
 | 
			
		||||
 | 
			
		||||
    Q_DECL_DEPRECATED QList<LookupItem> resolveBaseExpression(const QList<LookupItem> &baseResults,
 | 
			
		||||
                                                              int accessOp,
 | 
			
		||||
                                                              bool *replacedDotOperator = 0) const;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    ClassOrNamespace *findClass(const FullySpecifiedType &ty, Scope *scope) const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user