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

Side by Side Diff: scripts/dxr.js

Issue 29350140: Issue 4353 - Remove non standard for each syntax (Closed)
Patch Set: Created Aug. 24, 2016, 11:08 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // This is a simple test to test global magic 1 // This is a simple test to test global magic
2 2
3 include("../utils/cleanast.js"); 3 include("../utils/cleanast.js");
4 include("../utils/dumpast.js"); 4 include("../utils/dumpast.js");
5 include("../utils/jstypes.js"); 5 include("../utils/jstypes.js");
6 6
7 function process_js(ast, f) { 7 function process_js(ast, f) {
8 function loc(l) { 8 function loc(l) {
9 return f + ":" + l.line + ":" + l.column; 9 return f + ":" + l.line + ":" + l.column;
10 } 10 }
11 let toplevel = clean_ast(ast); 11 let toplevel = clean_ast(ast);
12 _print("Global variables:"); 12 _print("Global variables:");
13 for each (let v in toplevel.variables) { 13 for (let v of toplevel.variables) {
14 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column); 14 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column);
15 } 15 }
16 _print("Global constants:"); 16 _print("Global constants:");
17 for each (let v in toplevel.constants) { 17 for (let v of toplevel.constants) {
18 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column); 18 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column);
19 } 19 }
20 _print("Global objects:"); 20 _print("Global objects:");
21 for each (let v in toplevel.objects) { 21 for (let v of toplevel.objects) {
22 divine_inheritance(v, toplevel.constants); 22 divine_inheritance(v, toplevel.constants);
23 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column); 23 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column);
24 if (v.inherits) { 24 if (v.inherits) {
25 _print("\tInherits from " + v.inherits.join(", ")); 25 _print("\tInherits from " + v.inherits.join(", "));
26 } 26 }
27 _print("\tFunctions:"); 27 _print("\tFunctions:");
28 for (let name in v.functions) { 28 for (let name in v.functions) {
29 _print("\t\t" + name + " at " + loc(v.functions[name].loc)); 29 _print("\t\t" + name + " at " + loc(v.functions[name].loc));
30 } 30 }
31 _print("\tVariables:"); 31 _print("\tVariables:");
32 for (let name in v.variables) { 32 for (let name in v.variables) {
33 _print("\t\t" + name + " at " + loc(v.variables[name].loc)); 33 _print("\t\t" + name + " at " + loc(v.variables[name].loc));
34 } 34 }
35 _print("\tGetters:"); 35 _print("\tGetters:");
36 for (let name in v.getters) { 36 for (let name in v.getters) {
37 _print("\t\t" + name + " at " + loc(v.getters[name].loc)); 37 _print("\t\t" + name + " at " + loc(v.getters[name].loc));
38 } 38 }
39 _print("\tSetters:"); 39 _print("\tSetters:");
40 for (let name in v.setters) { 40 for (let name in v.setters) {
41 _print("\t\t" + name + " at " + loc(v.setters[name].loc)); 41 _print("\t\t" + name + " at " + loc(v.setters[name].loc));
42 } 42 }
43 } 43 }
44 _print("Global classes:"); 44 _print("Global classes:");
45 for each (let v in toplevel.classes) { 45 for (let v of toplevel.classes) {
46 divine_inheritance(v, toplevel.constants); 46 divine_inheritance(v, toplevel.constants);
47 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column); 47 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column);
48 if (v.inherits) { 48 if (v.inherits) {
49 _print("\tInherits from " + v.inherits.join(", ")); 49 _print("\tInherits from " + v.inherits.join(", "));
50 } 50 }
51 _print("\tFunctions:"); 51 _print("\tFunctions:");
52 for (let name in v.functions) { 52 for (let name in v.functions) {
53 _print("\t\t" + name + " at " + loc(v.functions[name].loc)); 53 _print("\t\t" + name + " at " + loc(v.functions[name].loc));
54 } 54 }
55 _print("\tVariables:"); 55 _print("\tVariables:");
56 for (let name in v.variables) { 56 for (let name in v.variables) {
57 _print("\t\t" + name + " at " + loc(v.variables[name].loc)); 57 _print("\t\t" + name + " at " + loc(v.variables[name].loc));
58 } 58 }
59 _print("\tGetters:"); 59 _print("\tGetters:");
60 for (let name in v.getters) { 60 for (let name in v.getters) {
61 _print("\t\t" + name + " at " + loc(v.getters[name].loc)); 61 _print("\t\t" + name + " at " + loc(v.getters[name].loc));
62 } 62 }
63 _print("\tSetters:"); 63 _print("\tSetters:");
64 for (let name in v.setters) { 64 for (let name in v.setters) {
65 _print("\t\t" + name + " at " + loc(v.setters[name].loc)); 65 _print("\t\t" + name + " at " + loc(v.setters[name].loc));
66 } 66 }
67 } 67 }
68 _print("Global functions:"); 68 _print("Global functions:");
69 for each (let v in toplevel.functions) { 69 for (let v of toplevel.functions) {
70 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column); 70 _print("\t" + v.name + " at " + f + ":" + v.loc.line + ":" + v.loc.column);
71 } 71 }
72 } 72 }
OLDNEW
« scripts/decompile.js ('K') | « scripts/doxygen.js ('k') | scripts/findInterfaces.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld