| 1 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
esid: sec-regexp-pattern-flags |
| 5 |
es6id: 21.2.3.1 |
| 6 |
description: Initial state of the `lastIndex` property |
| 7 |
info: | |
| 8 |
[...] |
| 9 |
7. Let O be ? RegExpAlloc(newTarget). |
| 10 |
8. Return ? RegExpInitialize(O, P, F). |
| 11 |
|
| 12 |
21.2.3.2.2 Runtime Semantics: RegExpInitialize |
| 13 |
|
| 14 |
[...] |
| 15 |
12. Perform ? Set(obj, "lastIndex", 0, true). |
| 16 |
[...] |
| 17 |
|
| 18 |
21.2.3.2.1 Runtime Semantics: RegExpAlloc |
| 19 |
|
| 20 |
[...] |
| 21 |
2. Perform ! DefinePropertyOrThrow(obj, "lastIndex", PropertyDescriptor |
| 22 |
{[[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}). |
| 23 |
[...] |
| 24 |
includes: [propertyHelper.js] |
| 25 |
---*/ |
| 26 |
|
| 27 |
var re = new RegExp(''); |
| 28 |
|
| 29 |
assert.sameValue(re.lastIndex, 0); |
| 30 |
|
| 31 |
verifyNotEnumerable(re, 'lastIndex'); |
| 32 |
verifyWritable(re, 'lastIndex'); |
| 33 |
verifyNotConfigurable(re, 'lastIndex'); |