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: --harmony-regexp-subclass | |
6 | |
7 "use strict"; | 5 "use strict"; |
8 | 6 |
9 function should_not_be_called() { | 7 function should_not_be_called() { |
10 throw new Error("should not be called"); | 8 throw new Error("should not be called"); |
11 } | 9 } |
12 | 10 |
13 (function() { | 11 (function() { |
14 var r = new RegExp("biep"); | 12 var r = new RegExp("biep"); |
15 assertTrue(r === RegExp(r)); | 13 assertTrue(r === RegExp(r)); |
16 assertFalse(r === new RegExp(r)); | 14 assertFalse(r === new RegExp(r)); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 (function() { | 103 (function() { |
106 class A extends RegExp { | 104 class A extends RegExp { |
107 get ["constructor"]() { log.push("constructor"); return RegExp; } | 105 get ["constructor"]() { log.push("constructor"); return RegExp; } |
108 } | 106 } |
109 var r = new A("biep"); | 107 var r = new A("biep"); |
110 var log = []; | 108 var log = []; |
111 var r2 = RegExp(r); | 109 var r2 = RegExp(r); |
112 assertEquals(["constructor"], log); | 110 assertEquals(["constructor"], log); |
113 assertTrue(r === r2); | 111 assertTrue(r === r2); |
114 })(); | 112 })(); |
OLD | NEW |