Web Inspector: Create Separate Model and View Objects for RemoteObjects / ObjectPrevi...
[WebKit-https.git] / LayoutTests / inspector / model / parse-script-syntax-tree.html
1 <!doctype html>
2 <html>
3 <head>
4 <script type="text/javascript" src="../../http/tests/inspector/inspector-test.js"></script>
5 <script>
6 function test()
7 {
8     function makeNode(text, isExpression)
9     {
10         var script = new WebInspector.Script(1, WebInspector.TextRange(0, text.length));
11         var scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(text, script);
12         var syntaxTree = scriptSyntaxTree._syntaxTree;
13
14         InspectorTest.assert(scriptSyntaxTree.parsedSuccessfully, "ScriptSyntaxTree should be able to parse: \"" + text + "\"");
15         InspectorTest.assert(syntaxTree.type === WebInspector.ScriptSyntaxTree.NodeType.Program, "Should be program.");
16         InspectorTest.assert(syntaxTree.body.length === 1, "Calling makeNode should return one node in the program.");
17         if (isExpression) {
18             InspectorTest.assert(syntaxTree.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
19             return syntaxTree.body[0].expression;
20         } else
21             return syntaxTree.body[0];
22     }
23
24     var node = null;
25
26     node = makeNode("x = 20;", true);
27     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression);
28     InspectorTest.assert(node.left);
29     InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
30     InspectorTest.assert(node.right);
31     InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
32     InspectorTest.assert(node.operator === "=");
33     node = makeNode("x += 20;", true);
34     InspectorTest.assert(node.operator === "+=");
35     node = makeNode("x -= 20;", true);
36     InspectorTest.assert(node.operator === "-=");
37     InspectorTest.log("passed AssignmentExpression");
38
39     node = makeNode("[1, 2]", true);
40     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression);
41     InspectorTest.assert(Array.isArray(node.elements));
42     InspectorTest.assert(node.elements.length === 2);
43     InspectorTest.assert(node.elements[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
44     InspectorTest.assert(node.elements[1].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
45     InspectorTest.log("passed ArrayExpression");
46     
47     node = makeNode("{foo();}", false);
48     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
49     InspectorTest.assert(node.body);
50     InspectorTest.assert(node.body.length === 1);
51     InspectorTest.assert(node.body[0].expression.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
52     InspectorTest.log("passed BlockStatement");
53
54     node = makeNode("2 + 2", true);
55     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression);
56     InspectorTest.assert(node.left);
57     InspectorTest.assert(node.right);
58     InspectorTest.assert(node.operator === "+");
59     node = makeNode("2 - 2", true);
60     InspectorTest.assert(node.operator === "-");
61     node = makeNode("2 * 2", true);
62     InspectorTest.assert(node.operator === "*");
63     node = makeNode("2 / 2", true);
64     InspectorTest.assert(node.operator === "/");
65     node = makeNode("2 % 2", true);
66     InspectorTest.assert(node.operator === "%");
67     node = makeNode("2 | 2", true);
68     InspectorTest.assert(node.operator === "|");
69     node = makeNode("2 ^ 2", true);
70     InspectorTest.assert(node.operator === "^");
71     node = makeNode("2 == 2", true);
72     InspectorTest.assert(node.operator === "==");
73     node = makeNode("2 === 2", true);
74     InspectorTest.assert(node.operator === "===");
75     InspectorTest.log("passed BinaryExpression");
76
77     node = makeNode("label:while(true) {break label;}", false);
78     InspectorTest.assert(node.body.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.BreakStatement);
79     InspectorTest.assert(node.body.body.body[0].label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
80     InspectorTest.assert(node.body.body.body[0].label.name === "label");
81     InspectorTest.log("passed BreakStatement");
82
83     node = makeNode("foo(20, 25)", true);
84     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.CallExpression);
85     InspectorTest.assert(node.arguments);
86     InspectorTest.assert(node.arguments.length === 2);
87     InspectorTest.assert(node.arguments[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
88     InspectorTest.assert(node.arguments[1].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
89     InspectorTest.log("passed CallExpression");
90
91     node = makeNode("try {} catch(e) {} ", false);
92     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.TryStatement);
93     InspectorTest.log("passed TryStatement");
94     InspectorTest.assert(node.handlers.length === 1);
95     InspectorTest.assert(node.handlers[0].type === WebInspector.ScriptSyntaxTree.NodeType.CatchClause);
96     InspectorTest.log("passed CatchClause");
97
98     node = makeNode("foo ? bar : baz;", true);
99     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression);
100     InspectorTest.assert(node.test);
101     InspectorTest.assert(node.consequent);
102     InspectorTest.assert(node.alternate);
103     InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
104     InspectorTest.assert(node.consequent.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
105     InspectorTest.assert(node.alternate.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
106     InspectorTest.log("passed ConditionalExpression");
107     
108     node = makeNode("label:while(true) {continue label;}", false);
109     InspectorTest.assert(node.body.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement);
110     InspectorTest.assert(node.body.body.body[0].label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
111     InspectorTest.assert(node.body.body.body[0].label.name === "label");
112     InspectorTest.log("passed ContinueStatement");
113
114     node = makeNode("do{}while(true);", false);
115     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.DoWhileStatement);
116     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
117     InspectorTest.assert(node.body.body.length === 0);
118     InspectorTest.assert(node.test);
119     InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
120     InspectorTest.log("passed DoWhileStatement");
121
122     node = makeNode("debugger;", false);
123     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement);
124     InspectorTest.log("passed DebuggerStatement");
125
126     node = makeNode(";", false);
127     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
128     InspectorTest.log("passed EmptyStatement");
129
130     node = makeNode("2 + 2", false);
131     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
132     InspectorTest.assert(node.expression);
133     InspectorTest.assert(node.expression.type === WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression);
134     InspectorTest.log("passed ExpressionStatement");
135
136     node = makeNode("for(x = 0;x < 20;x++){}", false);
137     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ForStatement);
138     InspectorTest.assert(node.init);
139     InspectorTest.assert(node.init.type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression);
140     InspectorTest.assert(node.test);
141     InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression);
142     InspectorTest.assert(node.update);
143     InspectorTest.assert(node.update.type === WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression);
144     InspectorTest.assert(node.body);
145     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
146     node = makeNode("for(x = 0;x < 20;x++);", false);
147     InspectorTest.assert(node.body);
148     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
149     InspectorTest.log("passed ForStatement");
150
151     node = makeNode("for(var x in {}){}", false);
152     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ForInStatement);
153     InspectorTest.assert(node.left);
154     InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
155     InspectorTest.assert(node.right);
156     InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
157     InspectorTest.assert(node.body);
158     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
159     node = makeNode("for(var x in {});", false);
160     InspectorTest.assert(node.body);
161     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement);
162     InspectorTest.log("passed ForInStatement");
163
164     node = makeNode("function foo(x,y){}", false);
165     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration);
166     InspectorTest.assert(node.params);
167     InspectorTest.assert(node.params.length === 2);
168     InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
169     InspectorTest.assert(node.params[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
170     InspectorTest.assert(node.body);
171     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
172     InspectorTest.assert(!node.isGetterOrSetter);
173     node = makeNode("x = {get foo(){return 20}}", true);
174     InspectorTest.assert(node.right.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
175     InspectorTest.assert(node.right.properties[0].value.isGetterOrSetter);
176     node = makeNode("x = {set foo(x){return 20}}", true);
177     InspectorTest.assert(node.right.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
178     InspectorTest.assert(node.right.properties[0].value.isGetterOrSetter);
179     InspectorTest.log("passed FunctionDeclaration");
180
181     node = makeNode("foo(function(x,y){})", true);
182     InspectorTest.assert(node.arguments[0].type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
183     InspectorTest.assert(node.arguments[0].params);
184     InspectorTest.assert(node.arguments[0].params.length === 2);
185     InspectorTest.assert(node.arguments[0].params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
186     InspectorTest.assert(node.arguments[0].params[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
187     InspectorTest.assert(node.arguments[0].body);
188     InspectorTest.assert(node.arguments[0].body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
189     InspectorTest.log("passed FunctionExpression");
190
191     node = makeNode("foo;", true);
192     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
193     InspectorTest.assert(node.name);
194     InspectorTest.assert(node.name === "foo");
195     InspectorTest.log("passed Identifier");
196
197     node = makeNode("if (true) baz; else bar;", false);
198     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.IfStatement);
199     InspectorTest.assert(node.test);
200     InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
201     InspectorTest.assert(node.consequent);
202     InspectorTest.assert(node.consequent.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
203     InspectorTest.assert(node.alternate);
204     InspectorTest.assert(node.alternate.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
205     InspectorTest.log("passed IfStatement");
206
207     node = makeNode("true;", true);
208     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
209     InspectorTest.assert(node.value === true);
210     InspectorTest.assert(node.raw === "true");
211     node = makeNode("false;", true);
212     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
213     InspectorTest.assert(node.value === false);
214     InspectorTest.assert(node.raw === "false");
215     node = makeNode("20;", true);
216     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
217     InspectorTest.assert(node.value === 20);
218     InspectorTest.assert(node.raw === "20");
219     node = makeNode("'20';", true);
220     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
221     InspectorTest.assert(node.value === '20');
222     InspectorTest.assert(node.raw === "'20'");
223     node = makeNode("null;", true);
224     InspectorTest.assert(node.value === null);
225     InspectorTest.assert(node.raw === "null");
226     node = makeNode("/regex/gi;", true);
227     InspectorTest.assert(node.value instanceof RegExp);
228     InspectorTest.assert(node.value.toString() === "/regex/gi");
229     InspectorTest.assert(node.raw === "/regex/gi");
230     node = makeNode("0x10", true);
231     InspectorTest.assert(node.value === 0x10);
232     InspectorTest.assert(node.raw === "0x10");
233     node = makeNode("0777", true);
234     InspectorTest.assert(node.value === 0777);
235     InspectorTest.assert(node.raw === "0777");
236     node = makeNode("\"a\"", true);
237     InspectorTest.assert(node.value === "a");
238     InspectorTest.assert(node.raw === "\"a\"");
239     InspectorTest.log("passed Literal");
240
241     node = makeNode("label:while(true)20;", false);
242     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.LabeledStatement);
243     InspectorTest.assert(node.label);
244     InspectorTest.assert(node.label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
245     InspectorTest.assert(node.label.name === "label");
246     InspectorTest.log("passed LabeledStatement");
247
248     node = makeNode("x && 20", true);
249     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.LogicalExpression);
250     InspectorTest.assert(node.left);
251     InspectorTest.assert(node.left.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
252     InspectorTest.assert(node.right);
253     InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
254     //InspectorTest.assert(node.operator === "&&");
255     node = makeNode("x || 20", true);
256     InspectorTest.assert(node.operator === "||");
257     InspectorTest.log("passed LogicalExpression");
258
259     node = makeNode("foo[20]", true);
260     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.MemberExpression);
261     InspectorTest.assert(node.computed);
262     InspectorTest.assert(node.object);
263     InspectorTest.assert(node.object.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
264     InspectorTest.assert(node.property);
265     InspectorTest.assert(node.property.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
266     node = makeNode("foo.bar", true);
267     InspectorTest.assert(!node.computed);
268     InspectorTest.assert(node.property.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
269     InspectorTest.log("passed MemberExpression");
270
271     node = makeNode("new Foo(20)", true);
272     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.NewExpression);
273     InspectorTest.assert(node.callee);
274     InspectorTest.assert(node.callee.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
275     InspectorTest.assert(node.arguments);
276     InspectorTest.assert(node.arguments.length === 1);
277     node = makeNode("new Foo", true);
278     InspectorTest.assert(node.arguments);
279     InspectorTest.assert(node.arguments.length === 0);
280     InspectorTest.log("passed NewExpression");
281
282     node = makeNode("x = {foo:bar};", true);
283     InspectorTest.assert(node.right.type === WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression);
284     InspectorTest.assert(node.right.properties);
285     InspectorTest.assert(node.right.properties.length === 1);
286     InspectorTest.log("passed ObjectExpression");
287
288     // Program is tested in makeNode
289
290     node = makeNode("x = {foo:20};", true);
291     InspectorTest.assert(node.right.properties[0].type === WebInspector.ScriptSyntaxTree.NodeType.Property);
292     InspectorTest.assert(node.right.properties[0].key);
293     InspectorTest.assert(node.right.properties[0].key.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
294     InspectorTest.assert(node.right.properties[0].value);
295     InspectorTest.assert(node.right.properties[0].value.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
296     node = makeNode("x = {'foo':20};", true);
297     InspectorTest.assert(node.right.properties[0].key);
298     InspectorTest.assert(node.right.properties[0].key.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
299     InspectorTest.log("passed Property");
300
301     node = makeNode("function foo() { return 20; }", false);
302     InspectorTest.assert(node.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement);
303     InspectorTest.assert(node.body.body[0].argument.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
304     node = makeNode("function foo() { return; }", false);
305     InspectorTest.assert(node.body.body[0].argument === null);
306     InspectorTest.log("passed ReturnStatement");
307
308     node = makeNode("(x, y)", true);
309     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.SequenceExpression);
310     InspectorTest.assert(node.expressions);
311     InspectorTest.assert(node.expressions.length === 2);
312     InspectorTest.assert(node.expressions[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
313     InspectorTest.assert(node.expressions[1].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
314     InspectorTest.log("passed SequenceExpression");
315
316     node = makeNode("switch(x){case y:break;}", false);
317     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement);
318     InspectorTest.assert(node.discriminant.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
319     InspectorTest.log("passed SwitchStatement");
320     InspectorTest.assert(node.cases[0].type === WebInspector.ScriptSyntaxTree.NodeType.SwitchCase);
321     InspectorTest.assert(node.cases[0].test.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
322     InspectorTest.assert(node.cases[0].consequent);
323     InspectorTest.assert(Array.isArray(node.cases[0].consequent));
324     InspectorTest.assert(node.cases[0].consequent.length === 1);
325     InspectorTest.log("passed SwitchCase");
326
327     node = makeNode("this;", true);
328     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ThisExpression);
329     InspectorTest.log("passed ThisExpression");
330
331     node = makeNode("throw new Error;", false);
332     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement);
333     InspectorTest.assert(node.argument);
334     InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.NewExpression);
335     InspectorTest.log("passed ThrowStatement");
336
337     node = makeNode("!foo;", true);
338     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.UnaryExpression);
339     InspectorTest.assert(node.argument);
340     InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
341     InspectorTest.assert(node.operator === "!");
342     node = makeNode("~foo;", true);
343     InspectorTest.assert(node.operator === "~");
344     node = makeNode("-foo;", true);
345     InspectorTest.assert(node.operator === "-");
346     InspectorTest.log("passed UnaryExpression");
347
348     node = makeNode("foo++;", true);
349     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression);
350     InspectorTest.assert(node.argument);
351     InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
352     InspectorTest.assert(node.operator === "++");
353     InspectorTest.assert(node.prefix === false);
354     node = makeNode("++foo;", true);
355     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression);
356     InspectorTest.assert(node.argument);
357     InspectorTest.assert(node.argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
358     InspectorTest.assert(node.prefix === true);
359     InspectorTest.assert(node.operator === "++");
360     node = makeNode("--foo;", true);
361     InspectorTest.assert(node.operator === "--");
362     node = makeNode("foo--;", true);
363     InspectorTest.assert(node.operator === "--");
364     InspectorTest.log("passed UpdateExpression");
365
366     node = makeNode("var foo = 20;", false);
367     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration);
368     InspectorTest.assert(node.declarations);
369     InspectorTest.assert(node.declarations.length === 1);
370     InspectorTest.log("passed VariableDeclaration");
371     InspectorTest.assert(node.declarations[0].type === WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator);
372     InspectorTest.assert(node.declarations[0].id);
373     InspectorTest.assert(node.declarations[0].id.type);
374     InspectorTest.assert(node.declarations[0].id.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
375     InspectorTest.assert(node.declarations[0].init);
376     InspectorTest.assert(node.declarations[0].init.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
377     node = makeNode("var foo;", false);
378     InspectorTest.assert(node.declarations[0].init === null);
379     InspectorTest.log("passed VariableDeclarator");
380
381     node = makeNode("while(true)boo;", false);
382     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.WhileStatement);
383     InspectorTest.assert(node.test);
384     InspectorTest.assert(node.test.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
385     InspectorTest.assert(node.body);
386     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
387     node = makeNode("while(true){}", false);
388     InspectorTest.assert(node.body);
389     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
390     InspectorTest.log("passed WhileStatement");
391
392     node = makeNode("with(o) {}", false);
393     InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.WithStatement);
394     InspectorTest.assert(node.object);
395     InspectorTest.assert(node.object.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
396     InspectorTest.assert(node.body);
397     InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
398     InspectorTest.log("passed WithStatement");
399
400     InspectorTest.log("passed ALL TESTS");
401     InspectorTest.completeTest();
402 }
403 </script>
404 </head>
405 <body onload="runTest()">
406 </body>
407 </html>