Mathias Panzenböck avatar Mathias Panzenböck committed 13d0cc3

scoping fixes

Comments (0)

Files changed (7)

 
 var keysOf = function (obj) {
 	var keys = [];
-	for (key in obj) {
+	for (var key in obj) {
 		keys.push(key);
 	}
 	return keys;
 			return false;
 		}
 
-		for (key in lkeys) {
+		for (var key in lkeys) {
 			if (!(key in rhs)) {
 				return false;
 			}
 	var trans = exports.load(moduleName, lang);
 	var tbl   = {};
 
-	for (name in orig) {
+	for (var name in orig) {
 		var otext = orig[name];
 		var ttext = trans[name];
 		tbl[otext] = ttext === undefined ? otext : ttext;
 	}
 
 	if (params !== undefined && params.options !== undefined) {
-		for (i in params.options) {
+		for (var i in params.options) {
 			var opt = params.options[i];
 			var names;
 
 			arguments: []
 		};
 
-		for (name in this.defaultValues) {
+		for (var name in this.defaultValues) {
 			var value = this.defaultValues[name];
 
 			if (value !== undefined) {
 			throw new Error(msg);
 		}
 
-		for (i in this.options) {
+		for (var i in this.options) {
 			var optdef = this.options[i];
 			if (optdef.required && !(optdef.target in got)) {
 				throw new Error('missing required option: ' + optdef.names[0]);
 
 		optdef.names = names;
 		
-		for (i in names) {
+		for (var i in names) {
 			var name = names[i];
 			var match = /(-*)(.*)/.exec(name);
 
 			optdef.help = optdef.help.trim();
 		}
 		
-		for (i in names) {
+		for (var i in names) {
 			this.optionsPerName[names[i]] = optdef;
 		}
 		
 		out.write('\n');
 		out.write(this.strings.options+':\n');
 
-		for (i in this.options) {
+		for (var i in this.options) {
 			var optdef = this.options[i];
 			var optnames = [];
 			var metavar = optdef.metavar;
 				metavar = metavar.join(' ');
 			}
 
-			for (j in optdef.names) {
+			for (var j in optdef.names) {
 				var optname = optdef.names[j];
 
 				if (metavar !== undefined) {
 			}
 			if (optdef.help) {
 				var lines = optdef.help.split('\n');
-				for (j in lines) {
+				for (var j in lines) {
 					out.write('\n        '+lines[j]);
 				}
 			}
 				}
 				optdef.argc = 0;
 				var metavar = [];
-				for (i in optdef.args) {
+				for (var i in optdef.args) {
 					var arg = optdef.args[i];
 					if (arg.target === undefined) {
 						arg.target = i;
 							' has illegal number of arguments');
 					}
 					if (arg.metavar instanceof Array) {
-						for (j in arg.metavar) {
+						for (var j in arg.metavar) {
 							metavar.push(arg.metavar[j]);
 						}
 					}
 		var labels = [];
 		var values = {};
 		if (optdef.values instanceof Array) {
-			for (i in optdef.values) {
+			for (var i in optdef.values) {
 				var value = optdef.values[i];
 				var label = String(value);
 				values[optdef.ignoreCase ? label.toLowerCase() : label] = value;
 			}
 		}
 		else {
-			for (label in optdef.values) {
+			for (var label in optdef.values) {
 				var value = optdef.values[label];
 				values[optdef.ignoreCase ? label.toLowerCase() : label] = value;
 				labels.push(optdef.stringify(label));
 }
 
 function defaults (target, defaults) {
-	for (name in defaults) {
+	for (var name in defaults) {
 		if (target[name] === undefined) {
 			target[name] = defaults[name];
 		}
 function stringifyAny (value) {
 	if (value instanceof Array) {
 		var buf = [];
-		for (i in value) {
+		for (var i in value) {
 			buf.push(stringifyAny(value[i]));
 		}
 		return buf.join(' ');
 	if (data) {
 		console.log('Options:');
 		var displayed = {};
-		for (name in parser.options) {
+		for (var name in parser.options) {
 			var opt = parser.options[name];
 			if (!(opt.target in displayed)) {
 				var value = data.options[opt.target];
 		}
 		console.log(''); 
 		console.log('Arguments:');
-		for (i in data.arguments) {
+		for (var i in data.arguments) {
 			console.log('\t'+data.arguments[i]);
 		}
 	}
 		var newpath = [];
 			
 		path = path.split('/');
-		for (i in path) {
+		for (var i in path) {
 			var part = path[i];
 			if (part == '..') {
 				newpath.splice(newpath.length-1,1);
 		*/
 
 		if (getters) {
-			for (name in getters) {
+			for (var name in getters) {
 				property(_require, name, getters[name]);
 			}
 		}
 			};
 
 			if (opts.globals) {
-				for (argname in opts.globals) {
+				for (var argname in opts.globals) {
 					if (!/^[_a-zA-Z][_a-zA-Z0-9]*$/.test(argname) || argname in globals) {
 						throw new Error('Illegal global name: '+argname);
 					}
 			}
 
 			// hide leakage:
-			for (name in window) {
+			for (var name in window) {
 				if (!(name in globals)) {
 					globals[name] = undefined;
 				}
 	}
 	var module = require(moduleName, opts);
 	
-	for (name in module) {
+	for (var name in module) {
 		this[name] = module[name];
 	}
 	return module;
 		search = search.substring(1);
 	}
 	var pairs = search.split('&');
-	for (i in pairs) {
+	for (var i in pairs) {
 		var pair = pairs[i].split('=');
 		exports.env[pair[0]] = pair[1];
 	}
 	var teardown = test.teardown || function () {};
 	var count = 0;
 
-	for (name in test) {
+	for (var name in test) {
 		if (name.substring(0,4) = 'test') {
 			try {
 				startup();
 		var oldUnflushed = this._unflushed_nsdecls;
 		var newUnflushed = {};
 
-		for (uri in oldUnflushed) {
+		for (var uri in oldUnflushed) {
 			newUnflushed[uri] = oldUnflushed[uri];
 		}
 
-		for (uri in oldPrefixes) {
+		for (var uri in oldPrefixes) {
 			newPrefixes[uri] = oldPrefixes[uri];
 		}
 
 		var uris = {};
-		for (prefix in prefixes) {
+		for (var prefix in prefixes) {
 			var uri = prefixes[prefix];
 			if (uri in uris) {
 				throw new Error('redeclared namespace uri: '+uri);
 		if (prefix === undefined) {
 			var prefixes = {};
 			
-			for (knownuri in this._prefixes) {
+			for (var knownuri in this._prefixes) {
 				prefixes[this._prefixes[knownuri]] = true;
 			}
 			
 		var sattrs = {};
 		var elemPrefix = null;
 		
-		for (uri in oldPrefixes) {
+		for (var uri in oldPrefixes) {
 			newPrefixes[uri] = oldPrefixes[uri];
 		}
 		
-		for (uri in unflushed) {
+		for (var uri in unflushed) {
 			putXmlns(sattrs, unflushed[uri], uri);
 		}
 
-		for (attrname in attrs) {
+		for (var attrname in attrs) {
 			var attr = attrs[attrname];
 			
 			if (!isXmlNameNS(attrname)) {
 		}
 		this._stream.write(name);
 
-		for (attrname in attrs) {
+		for (var attrname in attrs) {
 			this._stream.write(' '+attrname+'="'+escapeXml(attrs[attrname])+'"');
 		}
 		
 		if (hasAttrs) {
 			var count = 0;
 			var multi = false;
-			for (attrname in attrs) {
+			for (var attrname in attrs) {
 				count += 1;
 				if (count >= 2) {
 					multi = true;
 				attrsep = ' ';
 			}
 
-			for (attrname in attrs) {
+			for (var attrname in attrs) {
 				this._stream.write(attrsep+attrname+'="'+escapeXml(attrs[attrname])+'"');
 			}
 		}
 }
 
 function isEmpty (obj) {
-	for (name in obj) {
+	for (var name in obj) {
 		return false;
 	}
 	return true;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.