[gjs] Don't declare global variables



commit 3d6b6682d805a3438ed6e59b22f5ff827c6d9b50
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Feb 24 18:28:05 2011 +0100

    Don't declare global variables
    
    Scope all the variables to the block or the function, including
    those introduced by for..in.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647060

 modules/tweener/tweener.js |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/modules/tweener/tweener.js b/modules/tweener/tweener.js
index d18408a..daa1f6e 100644
--- a/modules/tweener/tweener.js
+++ b/modules/tweener/tweener.js
@@ -246,7 +246,7 @@ function _updateTweenByIndex(i) {
             }
         } while (currentTime >= nv);
     } else {
-        var mustUpdate;
+        var mustUpdate, name;
 
         if (currentTime >= tweening.timeComplete) {
             isOver = true;
@@ -435,7 +435,7 @@ function _constructPropertyList(obj) {
     }
 
     // Adds the modifiers to the list of properties
-    for (istr in modifiedProperties) {
+    for (let istr in modifiedProperties) {
         if (properties[istr]) {
             properties[istr].modifierParameters = modifiedProperties[istr].modifierParameters;
             properties[istr].modifierFunction = modifiedProperties[istr].modifierFunction;
@@ -482,7 +482,7 @@ function _addTweenOrCaller(target, tweeningParameters, isCaller) {
         scopes = new Array(target);
     }
 
-    var obj;
+    var obj, istr;
 
     if (isCaller) {
         obj = tweeningParameters;
@@ -613,6 +613,7 @@ function _getNumberOfProperties(object) {
 function removeTweensByTime(scope, properties, timeStart, timeComplete) {
     var removed = false;
     var removedLocally;
+    var name;
 
     for (let i = 0; i < _tweenList.length; i++) {
         removedLocally = false;
@@ -659,9 +660,10 @@ function _pauseTweenByIndex(i) {
 function _splitTweens(tween, properties) {
     var originalTween = _tweenList[tween];
     var newTween = originalTween.clone();
+    var name;
 
     for (let i = 0; i < properties.length; i++) {
-        var name = properties[i];
+        name = properties[i];
         if (originalTween.properties[name]) {
             originalTween.properties[name] = undefined;
             delete originalTween.properties[name];



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]