| 876 | } |
| 877 | |
| 878 | void DeclarationBuilder::declareComponentInstance(QmlJS::AST::ExpressionStatement* expression) |
| 879 | { |
| 880 | if (!expression) { |
| 881 | return; |
| 882 | } |
| 883 | |
| 884 | auto identifier = QmlJS::AST::cast<QmlJS::AST::IdentifierExpression *>(expression->expression); |
| 885 | |
| 886 | if (!identifier) { |
| 887 | return; |
| 888 | } |
| 889 | |
| 890 | { |
| 891 | DUChainWriteLocker lock; |
| 892 | |
| 893 | injectContext(topContext()); |
| 894 | auto* decl = openDeclaration<Declaration>( |
| 895 | Identifier(identifier->name.toString()), |
| 896 | m_session->locationToRange(identifier->identifierToken) |
| 897 | ); |
| 898 | closeInjectedContext(); |
| 899 | |
| 900 | // Put the declaration in the global scope |
| 901 | decl->setKind(Declaration::Instance); |
| 902 | decl->setType(currentAbstractType()); |
| 903 | } |
| 904 | closeDeclaration(); |
| 905 | } |
| 906 | |
| 907 | DeclarationBuilder::ExportLiteralsAndNames DeclarationBuilder::exportedNames(QmlJS::AST::ExpressionStatement* exports) |
| 908 | { |
nothing calls this directly
no test coverage detected