Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: test/mjsunit/regexp-lastIndex.js

Issue 1776883005: Put RegExp js code in strict mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Better testing Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/regexp.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // lastIndex is set according to funny rules. It is typically set only
6 // for global or sticky RegExps, but on a failure to find a match, it is
7 // set unconditionally. If a set fails, then it acts as if in strict mode
Yang 2016/03/15 06:56:36 I wonder whether it makes sense to discuss these f
8 // and throws.
9
10 var re = /x/;
11 Object.defineProperty(re, 'lastIndex', {writable: false});
12 assertThrows(() => re.exec(""), TypeError);
13 assertEquals(["x"], re.exec("x"));
14
15 var re = /x/y;
16 Object.defineProperty(re, 'lastIndex', {writable: false});
17 assertThrows(() => re.exec(""), TypeError);
18 assertThrows(() => re.exec("x"), TypeError);
OLDNEW
« no previous file with comments | « src/js/regexp.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698