Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/typebuilder.cpp
Show First 20 Lines • Show All 531 Lines • ▼ Show 20 Line(s) | 530 | if (StructureType::Ptr type = StructureType::Ptr::dynamicCast(v.result().type())) { | |||
---|---|---|---|---|---|
532 | if (!classDec) { | 532 | if (!classDec) { | ||
533 | ///FIXME: this is just a hack for https://bugs.kde.org/show_bug.cgi?id=269369 | 533 | ///FIXME: this is just a hack for https://bugs.kde.org/show_bug.cgi?id=269369 | ||
534 | /// a proper fix needs full fledged two-pass, i.e. get rid of PreDeclarationBuilder | 534 | /// a proper fix needs full fledged two-pass, i.e. get rid of PreDeclarationBuilder | ||
535 | // 0 == global lookup and the delcaration is found again... | 535 | // 0 == global lookup and the delcaration is found again... | ||
536 | classDec = dynamic_cast<ClassDeclaration*>(type->declaration(nullptr)); | 536 | classDec = dynamic_cast<ClassDeclaration*>(type->declaration(nullptr)); | ||
537 | } | 537 | } | ||
538 | if (classDec) { | 538 | if (classDec) { | ||
539 | /// Qualified identifier for 'iterator' | 539 | /// Qualified identifier for 'iterator' | ||
540 | static const QualifiedIdentifier iteratorQId(QStringLiteral("iterator")); | 540 | static QualifiedIdentifier iteratorQId(QStringLiteral("iterator")); | ||
541 | iteratorQId.setExplicitlyGlobal(true); | ||||
541 | ClassDeclaration* iteratorDecl = dynamic_cast<ClassDeclaration*>( | 542 | ClassDeclaration* iteratorDecl = dynamic_cast<ClassDeclaration*>( | ||
542 | findDeclarationImport(ClassDeclarationType, iteratorQId).data() | 543 | findDeclarationImport(ClassDeclarationType, iteratorQId).data() | ||
543 | ); | 544 | ); | ||
544 | Q_ASSERT(iteratorDecl); | 545 | Q_ASSERT(iteratorDecl); | ||
545 | if (classDec->isPublicBaseClass(iteratorDecl, currentContext()->topContext())) { | 546 | if (classDec->isPublicBaseClass(iteratorDecl, currentContext()->topContext())) { | ||
546 | /// Qualified identifier for 'current' | 547 | /// Qualified identifier for 'current' | ||
547 | static const QualifiedIdentifier currentQId(QStringLiteral("current")); | 548 | static const QualifiedIdentifier currentQId(QStringLiteral("current")); | ||
548 | auto classContext = classDec->internalContext(); | 549 | auto classContext = classDec->internalContext(); | ||
Show All 26 Lines | 569 | { | |||
575 | } | 576 | } | ||
576 | 577 | | |||
577 | } | 578 | } | ||
578 | 579 | | |||
579 | void TypeBuilder::visitVarExpression(Php::VarExpressionAst *node) | 580 | void TypeBuilder::visitVarExpression(Php::VarExpressionAst *node) | ||
580 | { | 581 | { | ||
581 | if (hasCurrentContextType() && node->isGenerator != -1 && !m_gotReturnTypeFromDocComment) { | 582 | if (hasCurrentContextType() && node->isGenerator != -1 && !m_gotReturnTypeFromDocComment) { | ||
582 | FunctionType::Ptr ft = FunctionType::Ptr::dynamicCast(currentContextType()); | 583 | FunctionType::Ptr ft = FunctionType::Ptr::dynamicCast(currentContextType()); | ||
583 | DeclarationPointer generatorDecl = findDeclarationImport(ClassDeclarationType, QualifiedIdentifier("generator")); | 584 | static QualifiedIdentifier generatorQId(QStringLiteral("generator")); | ||
585 | generatorQId.setExplicitlyGlobal(true); | ||||
586 | DeclarationPointer generatorDecl = findDeclarationImport(ClassDeclarationType, generatorQId); | ||||
584 | 587 | | |||
585 | if (ft && generatorDecl) { | 588 | if (ft && generatorDecl) { | ||
586 | AbstractType::Ptr generatorType = generatorDecl->abstractType(); | 589 | AbstractType::Ptr generatorType = generatorDecl->abstractType(); | ||
587 | 590 | | |||
588 | if (generatorType) { | 591 | if (generatorType) { | ||
589 | ft->setReturnType(generatorType); | 592 | ft->setReturnType(generatorType); | ||
590 | } | 593 | } | ||
591 | } | 594 | } | ||
Show All 14 Lines |