Debian Codegraph @

js/src/tests/test262/built-ins/RegExp/lastIndex.js

raw
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 description: Initial state of the `lastIndex` property
6 info: |
7 [...]
8 7. Let O be ? RegExpAlloc(newTarget).
9 8. Return ? RegExpInitialize(O, P, F).
10
11 21.2.3.2.2 Runtime Semantics: RegExpInitialize
12
13 [...]
14 12. Perform ? Set(obj, "lastIndex", 0, true).
15 [...]
16
17 21.2.3.2.1 Runtime Semantics: RegExpAlloc
18
19 [...]
20 2. Perform ! DefinePropertyOrThrow(obj, "lastIndex", PropertyDescriptor
21 {[[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).
22 [...]
23 includes: [propertyHelper.js]
24 ---*/
25
26 var re = new RegExp('');
27
28 assert.sameValue(re.lastIndex, 0);
29
30 verifyProperty(re, 'lastIndex', {
31 writable: true,
32 enumerable: false,
33 configurable: false,
34 });
35
36 reportCompare(0, 0);