From 42959f8fef145fd9301968b9b6ee2e66632b0f73 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Fri, 12 Feb 2010 10:05:13 +0100 Subject: [PATCH] Remove the lookup into including Qml files in the root scope of a JS file. --- src/libs/qmljs/qmljslink.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 5b9d38fa291..276006dad38 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -54,13 +54,16 @@ void Link::scopeChainAt(Document::Ptr doc, Node *currentObject) if (const ObjectValue *typeEnvironment = _context->typeEnvironment(doc.data())) _context->pushScope(typeEnvironment); } else { - // add scope chains for all components that source this document - foreach (Document::Ptr otherDoc, _docs) { - if (otherDoc->bind()->includedScripts().contains(doc->fileName())) - pushScopeChainForComponent(otherDoc, &linkedDocs); - } + // the global scope of a js file does not see the instantiating component + if (currentObject != 0) { + // add scope chains for all components that source this document + foreach (Document::Ptr otherDoc, _docs) { + if (otherDoc->bind()->includedScripts().contains(doc->fileName())) + pushScopeChainForComponent(otherDoc, &linkedDocs); + } - // ### TODO: Which type environment do scripts see? + // ### TODO: Which type environment do scripts see? + } _context->pushScope(bind->rootObjectValue()); } -- GitLab