| 71 | } |
| 72 | |
| 73 | void DeclarationBuilder::startVisiting(QmlJS::AST::Node* node) |
| 74 | { |
| 75 | DUContext* builtinQmlContext = nullptr; |
| 76 | |
| 77 | if (QmlJS::isQmlFile(currentContext()) && !currentContext()->url().str().contains(QLatin1String("__builtin_qml.qml"))) { |
| 78 | builtinQmlContext = m_session->contextOfFile( |
| 79 | QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kdevqmljssupport/nodejsmodules/__builtin_qml.qml")) |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | { |
| 84 | DUChainWriteLocker lock; |
| 85 | |
| 86 | // Remove all the imported parent contexts: imports may have been edited |
| 87 | // and there musn't be any leftover parent context |
| 88 | currentContext()->topContext()->clearImportedParentContexts(); |
| 89 | |
| 90 | // Initialize Node.js |
| 91 | QmlJS::NodeJS::instance().initialize(this); |
| 92 | |
| 93 | // Built-in QML types (color, rect, etc) |
| 94 | if (builtinQmlContext) { |
| 95 | topContext()->addImportedParentContext(builtinQmlContext); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | DeclarationBuilderBase::startVisiting(node); |
| 100 | } |
| 101 | |
| 102 | /* |
| 103 | * Functions |
nothing calls this directly
no test coverage detected