OLD | NEW |
| (Empty) |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Flags: --strong-mode --allow-natives-syntax | |
6 | |
7 (function() { | |
8 "use strict"; | |
9 | |
10 let foo = null; | |
11 | |
12 function nullLiteral() { | |
13 class Class1 extends null { | |
14 constructor() { | |
15 super(); | |
16 } | |
17 } | |
18 } | |
19 | |
20 function nullVariable() { | |
21 class Class2 extends foo { | |
22 constructor() { | |
23 super(); | |
24 } | |
25 } | |
26 } | |
27 | |
28 function nullLiteralClassExpr() { | |
29 (class extends null {}); | |
30 } | |
31 | |
32 function nullVariableClassExpr() { | |
33 (class extends foo {}); | |
34 } | |
35 | |
36 assertDoesNotThrow(nullLiteral); | |
37 %OptimizeFunctionOnNextCall(nullLiteral); | |
38 assertDoesNotThrow(nullLiteral); | |
39 | |
40 assertDoesNotThrow(nullVariable); | |
41 %OptimizeFunctionOnNextCall(nullVariable); | |
42 assertDoesNotThrow(nullVariable); | |
43 | |
44 assertDoesNotThrow(nullLiteralClassExpr); | |
45 %OptimizeFunctionOnNextCall(nullLiteralClassExpr); | |
46 assertDoesNotThrow(nullLiteralClassExpr); | |
47 | |
48 assertDoesNotThrow(nullVariableClassExpr); | |
49 %OptimizeFunctionOnNextCall(nullVariableClassExpr); | |
50 assertDoesNotThrow(nullVariableClassExpr); | |
51 })(); | |
52 | |
53 (function() { | |
54 "use strong"; | |
55 | |
56 let foo = null; | |
57 | |
58 function nullLiteral() { | |
59 class Class1 extends null { | |
60 constructor() { | |
61 super(); | |
62 } | |
63 } | |
64 } | |
65 | |
66 function nullVariable() { | |
67 class Class2 extends foo { | |
68 constructor() { | |
69 super(); | |
70 } | |
71 } | |
72 } | |
73 | |
74 function nullLiteralClassExpr() { | |
75 (class extends null {}); | |
76 } | |
77 | |
78 function nullVariableClassExpr() { | |
79 (class extends foo {}); | |
80 } | |
81 | |
82 assertThrows(nullLiteral, TypeError); | |
83 %OptimizeFunctionOnNextCall(nullLiteral); | |
84 assertThrows(nullLiteral, TypeError); | |
85 | |
86 assertThrows(nullVariable, TypeError); | |
87 %OptimizeFunctionOnNextCall(nullVariable); | |
88 assertThrows(nullVariable, TypeError); | |
89 | |
90 assertThrows(nullLiteralClassExpr, TypeError); | |
91 %OptimizeFunctionOnNextCall(nullLiteralClassExpr); | |
92 assertThrows(nullLiteralClassExpr, TypeError); | |
93 | |
94 assertThrows(nullVariableClassExpr, TypeError); | |
95 %OptimizeFunctionOnNextCall(nullVariableClassExpr); | |
96 assertThrows(nullVariableClassExpr, TypeError); | |
97 })(); | |
OLD | NEW |