~ubuntu-branches/ubuntu/quantal/kdevelop-php/quantal-proposed

« back to all changes in this revision

Viewing changes to duchain/builders/typebuilder.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-12-20 14:59:02 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101220145902-a6cmovse1qmue52p
Tags: 1.1.80-0ubuntu1
* New upstream release
* Build-dep on kdevplatform >= 1.1.80
* Get rid of l10n packages, not relevant in Ubuntu, put locale files into main package

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "typebuilder.h"
22
22
 
23
 
#include <ktexteditor/smartrange.h>
24
 
 
25
23
#include <language/duchain/identifier.h>
26
24
#include <language/duchain/duchain.h>
27
25
#include <language/duchain/duchainlock.h>
88
86
            type = "stdclass";
89
87
        }
90
88
        //don't use openTypeFromName as it uses cursor for findDeclarations
91
 
        Declaration* decl = findDeclarationImport(ClassDeclarationType, QualifiedIdentifier(type.toLower()), node);
 
89
        DeclarationPointer decl = findDeclarationImport(ClassDeclarationType,
 
90
                                                        QualifiedIdentifier(type.toLower()), node);
92
91
        if (decl && decl->abstractType()) {
93
92
            return decl->abstractType();
94
93
        }
344
343
    AbstractType::Ptr type;
345
344
    if (node->parameterType) {
346
345
        //don't use openTypeFromName as it uses cursor for findDeclarations
347
 
        Declaration* decl = findDeclarationImport(ClassDeclarationType,
 
346
        DeclarationPointer decl = findDeclarationImport(ClassDeclarationType,
348
347
                                                  identifierForNamespace(node->parameterType, editor()),
349
348
                                                  node->parameterType);
350
 
        if (decl) type = decl->abstractType();
 
349
        if (decl) {
 
350
            type = decl->abstractType();
 
351
        }
351
352
    } else if (node->arrayType != -1) {
352
353
        type = AbstractType::Ptr(new IntegralType(IntegralType::TypeArray));
353
354
    } else if (node->defaultValue) {
502
503
        if (StructureType::Ptr type = StructureType::Ptr::dynamicCast(v.result().type())) {
503
504
            ClassDeclaration *classDec = dynamic_cast<ClassDeclaration*>(type->declaration(currentContext()->topContext()));
504
505
            Q_ASSERT(classDec);
505
 
            lock.unlock();
506
506
            /// Qualified identifier for 'iterator'
507
 
            static const KDevelop::QualifiedIdentifier iteratorQId("iterator");
 
507
            static const QualifiedIdentifier iteratorQId("iterator");
508
508
            ClassDeclaration* iteratorDecl = dynamic_cast<ClassDeclaration*>(
509
 
                findDeclarationImport(ClassDeclarationType, iteratorQId, 0)
 
509
                findDeclarationImport(ClassDeclarationType, iteratorQId, 0).data()
510
510
            );
511
 
            lock.lock();
512
511
            Q_ASSERT(iteratorDecl);
513
512
            if (classDec->isPublicBaseClass(iteratorDecl, currentContext()->topContext())) {
514
513
                /// Qualified identifier for 'current'
515
 
                static const KDevelop::QualifiedIdentifier currentQId("current");
 
514
                static const QualifiedIdentifier currentQId("current");
516
515
                foreach (Declaration *d, classDec->internalContext()->findDeclarations(currentQId)) {
517
516
                    if (!dynamic_cast<ClassMethodDeclaration*>(d)) continue;
518
517
                    Q_ASSERT(d->type<FunctionType>());
531
530
void TypeBuilder::visitCatchItem(Php::CatchItemAst *node)
532
531
{
533
532
    TypeBuilderBase::visitCatchItem(node);
534
 
    KDevelop::Declaration *dec = findDeclarationImport(ClassDeclarationType, node->catchClass);
 
533
    DeclarationPointer dec = findDeclarationImport(ClassDeclarationType, node->catchClass);
535
534
    if (dec && dec->abstractType()) {
536
535
        openAbstractType(dec->abstractType());
537
536
        closeType();