Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: test/mjsunit/harmony/typesystem/variable-declarations.js

Issue 1871923003: Add parsing for ambient declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types-devel
Patch Set: Minor fixes to address code review comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-types 5 // Flags: --harmony-types
6 6
7 7
8 load("test/mjsunit/harmony/typesystem/typegen.js"); 8 load("test/mjsunit/harmony/typesystem/typegen.js");
9 debug = true; 9 debug = true;
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 t => keyword + " [x, y, ...rest] : (" + t + ")[] = [];" 44 t => keyword + " [x, y, ...rest] : (" + t + ")[] = [];"
45 ]), 45 ]),
46 new TestGen(1, InvalidTupleTypes, [ 46 new TestGen(1, InvalidTupleTypes, [
47 keyword != "const" && (t => keyword + " [x,, z] : " + t + ";"), 47 keyword != "const" && (t => keyword + " [x,, z] : " + t + ";"),
48 t => keyword + " [x,, z] : " + t + " = [undefined,, undefined];" 48 t => keyword + " [x,, z] : " + t + " = [undefined,, undefined];"
49 ]), 49 ]),
50 new TestGen(1, InvalidObjectTypes, [ 50 new TestGen(1, InvalidObjectTypes, [
51 keyword != "const" && (t => keyword + " {a: x, b: y} : " + t + ";"), 51 keyword != "const" && (t => keyword + " {a: x, b: y} : " + t + ";"),
52 t => keyword + " {a: x, b: y} : " + t + " = {a: 17, b: 42};" 52 t => keyword + " {a: x, b: y} : " + t + " = {a: 17, b: 42};"
53 ]), 53 ]),
54 "var [x, y]: number[];", 54 keyword + " [x, y]: number[];",
55 "var {a: x, b: y}: {a: number, b: string};", 55 keyword + " {a: x, b: y}: {a: number, b: string};",
56 "let [x, y]: number[];", 56 keyword == "const" && keyword + " x: number;"
57 "let {a: x, b: y}: {a: number, b: string};",
58 "const x: number;",
59 "const [x, y]: [number, string];",
60 "const {a: x, b: y}: {a: number, b: string};"
61 ]); 57 ]);
62 } 58 }
63 59
64 (function TestVariableDeclarations(size) { 60 (function TestVariableDeclarations(size) {
65 Test(size, [ 61 Test(size, [
66 new TestGen(1, ValidVariableDeclarations, [CheckValid], "var"), 62 new TestGen(1, ValidVariableDeclarations, [CheckValid], "var"),
67 new TestGen(1, ValidVariableDeclarations, [CheckValid], "let"), 63 new TestGen(1, ValidVariableDeclarations, [CheckValid], "let"),
68 new TestGen(1, ValidVariableDeclarations, [CheckValid], "const"), 64 new TestGen(1, ValidVariableDeclarations, [CheckValid], "const"),
69 new TestGen(1, InvalidVariableDeclarations, [CheckInvalid], "var"), 65 new TestGen(1, InvalidVariableDeclarations, [CheckInvalid], "var"),
70 new TestGen(1, InvalidVariableDeclarations, [CheckInvalid], "let"), 66 new TestGen(1, InvalidVariableDeclarations, [CheckInvalid], "let"),
71 new TestGen(1, InvalidVariableDeclarations, [CheckInvalid], "const") 67 new TestGen(1, InvalidVariableDeclarations, [CheckInvalid], "const")
72 ]); 68 ]);
73 })(test_size); 69 })(test_size);
OLDNEW
« src/parsing/preparser.cc ('K') | « test/mjsunit/harmony/typesystem/ambient-declarations.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698