OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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: --strong-mode | 5 // Flags: --strong-mode |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 function getClass() { | 9 function getClass() { |
10 class Foo { | 10 class Foo { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 static get bar() { return 0 } | 72 static get bar() { return 0 } |
73 get bar() { return 0 } | 73 get bar() { return 0 } |
74 } | 74 } |
75 return Foo; | 75 return Foo; |
76 } | 76 } |
77 | 77 |
78 testStrongClass(classFunc); | 78 testStrongClass(classFunc); |
79 assertDoesNotThrow(function(){addProperty(parent)}); | 79 assertDoesNotThrow(function(){addProperty(parent)}); |
80 assertDoesNotThrow(function(){convertPropertyToData(parent)}); | 80 assertDoesNotThrow(function(){convertPropertyToData(parent)}); |
81 })(); | 81 })(); |
82 | |
83 // Check strong classes don't freeze their children. | |
84 (function() { | |
85 let parent = getClassStrong(); | |
86 | |
87 let classFunc = function() { | |
88 class Foo extends parent { | |
89 static get bar() { return 0 } | |
90 get bar() { return 0 } | |
91 } | |
92 return Foo; | |
93 } | |
94 | |
95 assertThrows(function(){addProperty(parent)}, TypeError); | |
96 assertThrows(function(){convertPropertyToData(parent)}, TypeError); | |
97 testWeakClass(classFunc); | |
98 })(); | |
OLD | NEW |