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

Side by Side Diff: utils/jstypes.js

Issue 29350140: Issue 4353 - Remove non standard for each syntax (Closed)
Patch Set: Removed unused code Created Aug. 24, 2016, 2:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « utils/dumpast.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /**
2 * This file presents various methods to create a JS typing system.
3 */
4
5 function divine_inheritance(clazz, constants) {
6 let aliases = {};
7 for each (let c in constants) {
8 aliases[c.name] = c.init;
9 }
10
11 // First, do we have a QueryInterface variable?
12 if ("QueryInterface" in clazz.variables) {
13 // Yes, it's a function, but the variable means that we found a XPCOMUtils
14 // utility. This'll be easy!
15 let xpcom = clazz.variables.QueryInterface.init;
16 assert(xpcom.op == JSOP_CALL && xpcom.kids[0].atom == "generateQI");
17
18 if (!clazz.inherits)
19 clazz.inherits = [];
20 for each (let iface in xpcom.kids[1].kids)
21 clazz.inherits.push(iface.atom);
22 return;
23 }
24
25 if ("QueryInterface" in clazz.functions) {
26 if (!clazz.inherits)
27 clazz.inherits = [];
28 function findInterfaces(ast) {
29 if (ast.op == JSOP_GETPROP && ast.kids[0]) {
30 let check = ast.kids[0];
31 if (check.atom == "interfaces" && check.kids[0] &&
32 check.kids[0].atom == "Components") {
33 clazz.inherits.push(ast.atom);
34 }
35 }
36 }
37 visit(clazz.functions.QueryInterface.body, findInterfaces, aliases);
38 return;
39 }
40 }
OLDNEW
« no previous file with comments | « utils/dumpast.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld