Rewrite for…each with for…of				#68
		
		
	
					 7 changed files with 21 additions and 21 deletions
				
			
		|  | @ -518,7 +518,7 @@ jala.db.DataType = function(type, typeName, params) { | ||||||
|    this.getParams = function() { |    this.getParams = function() { | ||||||
|       return params; |       return params; | ||||||
|    }; |    }; | ||||||
|     | 
 | ||||||
|    /** @ignore */ |    /** @ignore */ | ||||||
|    this.toString = function() { |    this.toString = function() { | ||||||
|       return "[DataType " + |       return "[DataType " + | ||||||
|  | @ -597,7 +597,7 @@ jala.db.RamDatabase = function(name, username, password) { | ||||||
|    this.getUsername = function() { |    this.getUsername = function() { | ||||||
|       return username || "sa"; |       return username || "sa"; | ||||||
|    }; |    }; | ||||||
|     | 
 | ||||||
|    /** |    /** | ||||||
|     * Returns the password of this database |     * Returns the password of this database | ||||||
|     * @returns The password of this database |     * @returns The password of this database | ||||||
|  | @ -841,7 +841,7 @@ jala.db.RamDatabase.prototype.copyTables = function(database, tables) { | ||||||
|          tables = jala.db.metadata.getTableNames(dbMetadata); |          tables = jala.db.metadata.getTableNames(dbMetadata); | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       for each (var tableName in tables) { |       for (let tableName of tables) { | ||||||
|          // drop the table if it exists
 |          // drop the table if it exists
 | ||||||
|          if (this.tableExists(tableName)) { |          if (this.tableExists(tableName)) { | ||||||
|             this.dropTable(tableName); |             this.dropTable(tableName); | ||||||
|  | @ -1011,7 +1011,7 @@ jala.db.FileDatabase = function(name, directory, username, password) { | ||||||
|    this.getUsername = function() { |    this.getUsername = function() { | ||||||
|       return username || "sa"; |       return username || "sa"; | ||||||
|    }; |    }; | ||||||
|     | 
 | ||||||
|    /** |    /** | ||||||
|     * Returns the password of this database |     * Returns the password of this database | ||||||
|     * @returns The password of this database |     * @returns The password of this database | ||||||
|  |  | ||||||
|  | @ -330,7 +330,7 @@ MessageParser.prototype.parseSkinFile = function(file, encoding) { | ||||||
|   var processMacros = function(macros) { |   var processMacros = function(macros) { | ||||||
|     var re = gettext_macro.REGEX; |     var re = gettext_macro.REGEX; | ||||||
|     var id, pluralId, name, args, param, key, msg; |     var id, pluralId, name, args, param, key, msg; | ||||||
|     for each (var macro in macros) { |     for (let macro of macros) { | ||||||
|       id = pluralId = null; |       id = pluralId = null; | ||||||
|       name = macro.getName(); |       name = macro.getName(); | ||||||
|       param = macro.getNamedParams(); |       param = macro.getNamedParams(); | ||||||
|  | @ -374,7 +374,7 @@ MessageParser.prototype.parseSkinFile = function(file, encoding) { | ||||||
|   if (skin.hasMainskin()) { |   if (skin.hasMainskin()) { | ||||||
|     processMacros(skin.getMacros()); |     processMacros(skin.getMacros()); | ||||||
|   } |   } | ||||||
|   for each (var name in skin.getSubskinNames()) { |   for (let name of skin.getSubskinNames()) { | ||||||
|     var subskin = skin.getSubskin(name); |     var subskin = skin.getSubskin(name); | ||||||
|     processMacros(subskin.getMacros()); |     processMacros(subskin.getMacros()); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -41,7 +41,7 @@ app.addRepository("modules/helma/Http.js"); | ||||||
| /** | /** | ||||||
|  * Jala dependencies |  * Jala dependencies | ||||||
|  */ |  */ | ||||||
| app.addRepository(getProperty("jala.dir", "modules/jala") +  | app.addRepository(getProperty("jala.dir", "modules/jala") + | ||||||
|                   "/code/Database.js"); |                   "/code/Database.js"); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -573,11 +573,11 @@ jala.Test.prototype.executeTest = function(testFile) { | ||||||
|    } finally { |    } finally { | ||||||
|       // exit the js context created above
 |       // exit the js context created above
 | ||||||
|       cx.exit(); |       cx.exit(); | ||||||
|       // FIXME (sim) don't polute global in the first place or 
 |       // FIXME (sim) don't polute global in the first place or
 | ||||||
|       //             get a fresh global for each testrun
 |       //             get a fresh global for each testrun
 | ||||||
|       global.testFunctionIdents.forEach(function(funcName) { |       global.testFunctionIdents.forEach(function(funcName) { | ||||||
|          // NOTE won't work on var-defined props
 |          // NOTE won't work on var-defined props
 | ||||||
|          // delete global[funcName]] 
 |          // delete global[funcName]]
 | ||||||
|          global[funcName] = "ignoreMe"; |          global[funcName] = "ignoreMe"; | ||||||
|       }, this); |       }, this); | ||||||
|       global["setup"] = "ignoreMe"; |       global["setup"] = "ignoreMe"; | ||||||
|  | @ -861,7 +861,7 @@ jala.Test.prototype.assertEqualFile = function assertEqualFile(val, file) { | ||||||
|       // the last linefeed in a file too
 |       // the last linefeed in a file too
 | ||||||
|       var str = value1.replace(/\r?\n$/g, ""); |       var str = value1.replace(/\r?\n$/g, ""); | ||||||
|       equals = str === file.readAll(); |       equals = str === file.readAll(); | ||||||
|    }       |    } | ||||||
|    if (!equals) { |    if (!equals) { | ||||||
|       throw new jala.Test.TestException(comment, |       throw new jala.Test.TestException(comment, | ||||||
|                       "Expected " + jala.Test.valueToString(value1) + |                       "Expected " + jala.Test.valueToString(value1) + | ||||||
|  | @ -1155,7 +1155,7 @@ jala.Test.HttpClient = function() { | ||||||
|    this.getClient = function() { |    this.getClient = function() { | ||||||
|       return client; |       return client; | ||||||
|    }; |    }; | ||||||
|     | 
 | ||||||
|    /** |    /** | ||||||
|     * Sets the cookie to use for subsequent requests using this client |     * Sets the cookie to use for subsequent requests using this client | ||||||
|     * @param {Array} arr The cookie object as received from helma.Http.getUrl |     * @param {Array} arr The cookie object as received from helma.Http.getUrl | ||||||
|  | @ -1336,7 +1336,7 @@ jala.Test.DatabaseMgr.prototype.startDatabase = function(dbSourceName, copyTable | ||||||
|             // collect the table names of all relational prototypes
 |             // collect the table names of all relational prototypes
 | ||||||
|             tables = []; |             tables = []; | ||||||
|             var protos = app.getPrototypes(); |             var protos = app.getPrototypes(); | ||||||
|             for each (var proto in protos) { |             for (let proto of protos) { | ||||||
|                var dbMap = proto.getDbMapping(); |                var dbMap = proto.getDbMapping(); | ||||||
|                if (dbMap.isRelational()) { |                if (dbMap.isRelational()) { | ||||||
|                   tables.push(dbMap.getTableName()); |                   tables.push(dbMap.getTableName()); | ||||||
|  | @ -1401,7 +1401,7 @@ jala.Test.DatabaseMgr.prototype.stopAll = function() { | ||||||
|  */ |  */ | ||||||
| jala.Test.SmtpServer = function(port) { | jala.Test.SmtpServer = function(port) { | ||||||
|    var server = null; |    var server = null; | ||||||
|     | 
 | ||||||
|    var oldSmtpServer = null; |    var oldSmtpServer = null; | ||||||
| 
 | 
 | ||||||
|    /** |    /** | ||||||
|  |  | ||||||
|  | @ -149,7 +149,7 @@ function testOrder(org, pos) { | ||||||
| 
 | 
 | ||||||
| function cleanup() { | function cleanup() { | ||||||
|     var persons = root.persons.list(); |     var persons = root.persons.list(); | ||||||
|     for each (var person in persons) { |     for (let person of persons) { | ||||||
|         person.remove(); |         person.remove(); | ||||||
|     } |     } | ||||||
|     ikea.remove(); |     ikea.remove(); | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								src/dist/apps/test/tests/HopObjectGeneric.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								src/dist/apps/test/tests/HopObjectGeneric.js
									
										
									
									
										vendored
									
									
								
							|  | @ -86,7 +86,7 @@ function testAdd() { | ||||||
| 
 | 
 | ||||||
| function cleanup() { | function cleanup() { | ||||||
|     var persons = org.generic.list(); |     var persons = org.generic.list(); | ||||||
|     for each (var person in persons) { |     for (let person of persons) { | ||||||
|         person.remove(); |         person.remove(); | ||||||
|     } |     } | ||||||
|     org.remove(); |     org.remove(); | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								src/dist/apps/test/tests/HopObjectGroupBy.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								src/dist/apps/test/tests/HopObjectGroupBy.js
									
										
									
									
										vendored
									
									
								
							|  | @ -68,7 +68,7 @@ function testGroupByAddRemoveNoCommit() { | ||||||
|    // FIXME HELMABUG: country is still accessible at this point
 |    // FIXME HELMABUG: country is still accessible at this point
 | ||||||
|    // similar to http://helma.org/bugs/show_bug.cgi?id=551
 |    // similar to http://helma.org/bugs/show_bug.cgi?id=551
 | ||||||
|    assertNull(root.organisationsByCountry.get(org.country)); |    assertNull(root.organisationsByCountry.get(org.country)); | ||||||
|     | 
 | ||||||
|    assertEqual(countryCount, root.organisationsByCountry.count()); |    assertEqual(countryCount, root.organisationsByCountry.count()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -130,7 +130,7 @@ function testGroupTransient() { | ||||||
|    assertNotNull(country); |    assertNotNull(country); | ||||||
|    assertEqual(country._prototype, "Country"); |    assertEqual(country._prototype, "Country"); | ||||||
|    assertEqual(country.groupname, org.country); |    assertEqual(country.groupname, org.country); | ||||||
|     | 
 | ||||||
|    // These don't work as org uses the parent from type.properties
 |    // These don't work as org uses the parent from type.properties
 | ||||||
|    // which is root.organisations. Not sure if this is a bug or not.
 |    // which is root.organisations. Not sure if this is a bug or not.
 | ||||||
|    // assertEqual(country, org._parent);
 |    // assertEqual(country, org._parent);
 | ||||||
|  | @ -143,7 +143,7 @@ function testGroupTransient() { | ||||||
| 
 | 
 | ||||||
| function cleanup() { | function cleanup() { | ||||||
|     var orgs = root.organisations.list(); |     var orgs = root.organisations.list(); | ||||||
|     for each (var org in orgs) { |     for (let org of orgs) { | ||||||
|         org.remove(); |         org.remove(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -93,8 +93,8 @@ public final class RhinoCore implements ScopeProvider { | ||||||
|     // optimization level for rhino engine, ranges from -1 to 9 |     // optimization level for rhino engine, ranges from -1 to 9 | ||||||
|     int optLevel = 0; |     int optLevel = 0; | ||||||
| 
 | 
 | ||||||
|     // language version - default to JS 1.8 |     // language version - default to ES6 | ||||||
|     int languageVersion = 180; |     int languageVersion = 200; | ||||||
| 
 | 
 | ||||||
|     // debugger/tracer flags |     // debugger/tracer flags | ||||||
|     boolean hasDebugger = false; |     boolean hasDebugger = false; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue