Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: utils/cleanast.js

Issue 29350140: Issue 4353 - Remove non standard for each syntax (Closed)
Patch Set: Created Aug. 24, 2016, 11:08 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« scripts/decompile.js ('K') | « utils/astml.js ('k') | utils/comments.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/cleanast.js
diff --git a/utils/cleanast.js b/utils/cleanast.js
index 3aac61818ae171ad8cbe8b06890a183d5ce1672c..7a1b144e72f76491e5be5bd8485bfa4817ce137b 100644
--- a/utils/cleanast.js
+++ b/utils/cleanast.js
@@ -24,7 +24,7 @@ function clean_ast(ast) {
code: []
};
- for each (let statement in ast.kids) {
+ for (let statement of ast.kids) {
if (statement.op == JSOP_DEFVAR) {
let ret = make_variables(statement);
info.variables = info.variables.concat(ret.vars);
@@ -54,7 +54,7 @@ function visit(root_ast, func, to_expand) {
if (ast == null)
return;
if (func(ast)) return;
- for each (let child in ast.kids)
+ for (let child of ast.kids)
v_r(child, func);
}
@@ -66,9 +66,9 @@ function visit(root_ast, func, to_expand) {
ast.expanded = true;
}
let sanitized_ast = { kids: [] };
- for (let key in ast) {
+ for (let key of ast) {
if (key == 'kids') {
- for each (let kid in ast.kids) {
+ for (let kid of ast.kids) {
sanitized_ast.kids.push(sanitize(kid));
}
} else {
@@ -157,7 +157,7 @@ function make_variables(var_root) {
assert(var_root.op == JSOP_DEFVAR || var_root.op == JSOP_DEFCONST);
let variables = [];
let objects = [];
- for each (let name in var_root.kids) {
+ for (let name of var_root.kids) {
let v = { name: name.atom };
v.init = (name.kids.length > 0 ? name.kids[0] : null);
v.loc = get_location(var_root);
@@ -179,10 +179,10 @@ function make_object(stub) {
let proto = stub.init.op == JSOP_GETPROP && stub.init.atom == 'prototype';
delete stub['init'];
if (proto) {
- stub.inherits = [ast.kids[0].atom];
- return stub;
+ stub.inherits = [ast.kids[0].atom];
+ return stub;
}
- for each (let init in ast.kids) {
+ for (let init of ast.kids) {
if (init.type != TOK_COLON) {
dump_ast(init);
}
« scripts/decompile.js ('K') | « utils/astml.js ('k') | utils/comments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld