MCPcopy Create free account
hub / github.com/KDE/kdevelop / declareComponentInstance

Method declareComponentInstance

plugins/qmljs/duchain/declarationbuilder.cpp:878–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878void 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
907DeclarationBuilder::ExportLiteralsAndNames DeclarationBuilder::exportedNames(QmlJS::AST::ExpressionStatement* exports)
908{

Callers

nothing calls this directly

Calls 7

topContextFunction · 0.85
closeDeclarationFunction · 0.85
locationToRangeMethod · 0.80
IdentifierFunction · 0.50
toStringMethod · 0.45
setKindMethod · 0.45
setTypeMethod · 0.45

Tested by

no test coverage detected