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

Method exportedNames

plugins/qmljs/duchain/declarationbuilder.cpp:907–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

905}
906
907DeclarationBuilder::ExportLiteralsAndNames DeclarationBuilder::exportedNames(QmlJS::AST::ExpressionStatement* exports)
908{
909 ExportLiteralsAndNames res;
910
911 if (!exports) {
912 return res;
913 }
914
915 auto exportslist = QmlJS::AST::cast<QmlJS::AST::ArrayLiteral*>(exports->expression);
916
917 if (!exportslist) {
918 return res;
919 }
920
921 // Explore all the exported symbols for this component and keep only those
922 // having a version compatible with the one of this module
923 QSet<QString> knownNames;
924
925 for (auto it = exportslist->elements; it && it->expression; it = it->next) {
926 auto stringliteral = QmlJS::AST::cast<QmlJS::AST::StringLiteral *>(it->expression);
927
928 if (!stringliteral) {
929 continue;
930 }
931
932 // String literal like "Namespace/Class version".
933 QStringList nameAndVersion = stringliteral->value.toString().section(QLatin1Char('/'), -1, -1).split(QLatin1Char(' '));
934 QString name = nameAndVersion.at(0);
935
936 if (Algorithm::insert(knownNames, name).inserted) {
937 res.append(qMakePair(stringliteral, name));
938 }
939 }
940
941 return res;
942}
943
944
945void DeclarationBuilder::declareExports(const ExportLiteralsAndNames& exports,

Callers

nothing calls this directly

Calls 6

insertFunction · 0.85
sectionMethod · 0.80
splitMethod · 0.45
toStringMethod · 0.45
atMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected