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

Unified Diff: scripts/decompile.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
Index: scripts/decompile.js
diff --git a/scripts/decompile.js b/scripts/decompile.js
index 250ae2afb74ce55523cfd2edfd979014108d136e..b21529a6e9aaa0931ff09686d81b6202d81bbede 100644
--- a/scripts/decompile.js
+++ b/scripts/decompile.js
@@ -8,7 +8,7 @@ let visitor = {
if (post === undefined) post = ')';
if (comma === undefined) comma = ', ';
output(pre);
- for each (let arg in arr) {
+ for (let arg of arr) {
arg.visit(this);
output(comma);
}
@@ -28,7 +28,7 @@ let visitor = {
},
_visitNeedBlock: function (stmt, noFlush) {
if (stmt.type == "EmptyStatement") {
- output("{}")
+ output("{}");
if (!noFlush)
flush();
}
@@ -446,9 +446,13 @@ function sanitize(str, q) {
if (x == '\r') return '\\r';
if (x == '\t') return '\\t';
if (x == '\v') return '\\v';
- let val = x.charCodeAt(0)
+ let val = x.charCodeAt(0);
if (x < ' ') return '\\x' + (val - val % 16) / 16 + (val % 16);
return x;
}
- return [replace(x) for each (x in str)].join('');
+
+ let result = "";
+ for (let char of str)
+ result += replace(char);
+ return result;
}
« scripts/astDecompile.js ('K') | « scripts/astDecompile.js ('k') | scripts/doxygen.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld