lastIndex.js 864 B

1234567891011121314151617181920212223242526272829303132
  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. 21.2.3.2.2 Runtime Semantics: RegExpInitialize
  11. [...]
  12. 12. Perform ? Set(obj, "lastIndex", 0, true).
  13. [...]
  14. 21.2.3.2.1 Runtime Semantics: RegExpAlloc
  15. [...]
  16. 2. Perform ! DefinePropertyOrThrow(obj, "lastIndex", PropertyDescriptor
  17. {[[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).
  18. [...]
  19. includes: [propertyHelper.js]
  20. ---*/
  21. var re = new RegExp('');
  22. assert.sameValue(re.lastIndex, 0);
  23. verifyNotEnumerable(re, 'lastIndex');
  24. verifyWritable(re, 'lastIndex');
  25. verifyNotConfigurable(re, 'lastIndex');