From 9af4f2c64f3de6153bdcd5710b418052349ce55a Mon Sep 17 00:00:00 2001
From: Christian Kamm <christian.d.kamm@nokia.com>
Date: Wed, 28 Apr 2010 09:40:51 +0200
Subject: [PATCH] QmlJS: Remove unused function environment from binder.

This used to contain all functions declared in Script blocks. With them
gone, there's no reason to keep it.
---
 src/libs/qmljs/qmljsbind.cpp        | 7 -------
 src/libs/qmljs/qmljsbind.h          | 2 --
 src/libs/qmljs/qmljsinterpreter.cpp | 3 ---
 src/libs/qmljs/qmljsinterpreter.h   | 1 -
 src/libs/qmljs/qmljslink.cpp        | 1 -
 5 files changed, 14 deletions(-)

diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index 6118237a8c8..00d90139bc0 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -43,7 +43,6 @@ Bind::Bind(Document *doc)
     : _doc(doc),
       _currentObjectValue(0),
       _idEnvironment(0),
-      _functionEnvironment(0),
       _rootObjectValue(0)
 {
     if (_doc)
@@ -79,11 +78,6 @@ Interpreter::ObjectValue *Bind::idEnvironment() const
     return _idEnvironment;
 }
 
-Interpreter::ObjectValue *Bind::functionEnvironment() const
-{
-    return _functionEnvironment;
-}
-
 Interpreter::ObjectValue *Bind::rootObjectValue() const
 {
     return _rootObjectValue;
@@ -175,7 +169,6 @@ void Bind::accept(Node *node)
 bool Bind::visit(AST::UiProgram *)
 {
     _idEnvironment = _engine.newObject(/*prototype =*/ 0);
-    _functionEnvironment = _engine.newObject(/*prototype =*/ 0);
     return true;
 }
 
diff --git a/src/libs/qmljs/qmljsbind.h b/src/libs/qmljs/qmljsbind.h
index bb1a77f5269..9de6f2709cc 100644
--- a/src/libs/qmljs/qmljsbind.h
+++ b/src/libs/qmljs/qmljsbind.h
@@ -56,7 +56,6 @@ public:
 
     Interpreter::ObjectValue *currentObjectValue() const;
     Interpreter::ObjectValue *idEnvironment() const;
-    Interpreter::ObjectValue *functionEnvironment() const;
     Interpreter::ObjectValue *rootObjectValue() const;
 
     Interpreter::ObjectValue *findQmlObject(AST::Node *node) const;
@@ -98,7 +97,6 @@ private:
 
     Interpreter::ObjectValue *_currentObjectValue;
     Interpreter::ObjectValue *_idEnvironment;
-    Interpreter::ObjectValue *_functionEnvironment;
     Interpreter::ObjectValue *_rootObjectValue;
 
     QHash<AST::Node *, Interpreter::ObjectValue *> _qmlObjects;
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index d6c9a820cbd..a3cf3270486 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -1316,7 +1316,6 @@ void ScopeChain::QmlComponentChain::clear()
     qDeleteAll(instantiatingComponents);
     instantiatingComponents.clear();
     rootObject = 0;
-    functionScopes.clear();
     ids = 0;
 }
 
@@ -1327,7 +1326,6 @@ void ScopeChain::QmlComponentChain::add(QList<const ObjectValue *> *list) const
 
     if (rootObject)
         list->append(rootObject);
-    list->append(functionScopes);
     if (ids)
         list->append(ids);
 }
@@ -1347,7 +1345,6 @@ void ScopeChain::update()
     if (qmlComponentScope.rootObject && ! qmlScopeObjects.contains(qmlComponentScope.rootObject))
         _all += qmlComponentScope.rootObject;
     _all += qmlScopeObjects;
-    _all += qmlComponentScope.functionScopes;
     if (qmlComponentScope.ids)
         _all += qmlComponentScope.ids;
     if (qmlTypes)
diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h
index a22d78edd72..309765e9bea 100644
--- a/src/libs/qmljs/qmljsinterpreter.h
+++ b/src/libs/qmljs/qmljsinterpreter.h
@@ -256,7 +256,6 @@ public:
 
         QList<QmlComponentChain *> instantiatingComponents;
         const ObjectValue *rootObject;
-        QList<const ObjectValue *> functionScopes;
         const ObjectValue *ids;
 
         void add(QList<const ObjectValue *> *list) const;
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 3a854647677..fbbe4071e70 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -115,7 +115,6 @@ void Link::makeComponentChain(
     if (bind->rootObjectValue())
         target->rootObject = bind->rootObjectValue();
 
-    target->functionScopes += bind->functionEnvironment();
     target->ids = bind->idEnvironment();
 }
 
-- 
GitLab