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: --allow-natives-syntax --harmony-regexp-subclass | 5 // Flags: --allow-natives-syntax --harmony-regexp-subclass |
6 // Flags: --expose-gc | 6 // Flags: --expose-gc |
7 | 7 |
8 "use strict"; | 8 "use strict"; |
9 | 9 |
10 | 10 |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 | 912 |
913 var pattern = {toString() { | 913 var pattern = {toString() { |
914 log.push("tostring"); | 914 log.push("tostring"); |
915 f.prototype = p3; return "biep" }}; | 915 f.prototype = p3; return "biep" }}; |
916 | 916 |
917 Object.defineProperty(pattern, Symbol.match, { | 917 Object.defineProperty(pattern, Symbol.match, { |
918 get() { log.push("match"); f.prototype = p2; return false; }}); | 918 get() { log.push("match"); f.prototype = p2; return false; }}); |
919 | 919 |
920 var o = Reflect.construct(RegExp, [pattern], f); | 920 var o = Reflect.construct(RegExp, [pattern], f); |
921 assertEquals(["match", "tostring"], log); | 921 assertEquals(["match", "tostring"], log); |
922 assertEquals(/biep/, o); | 922 // TODO(littledan): Is the RegExp constructor correct to create |
| 923 // the internal slots and do these type checks this way? |
| 924 assertEquals("biep", %_RegExpSource(o)); |
| 925 assertThrows(() => Object.getOwnPropertyDescriptor(RegExp.prototype, |
| 926 'source').get(o), |
| 927 TypeError); |
| 928 assertEquals("/undefined/undefined", RegExp.prototype.toString.call(o)); |
923 assertTrue(o.__proto__ === p2); | 929 assertTrue(o.__proto__ === p2); |
924 assertTrue(f.prototype === p3); | 930 assertTrue(f.prototype === p3); |
925 })(); | 931 })(); |
OLD | NEW |