| OLD | NEW |
| 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 Loading... |
| 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); |
| OLD | NEW |