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

Issue 10068010: Regexp: Fix rightContext in the lastMatchInfoOverride (Closed)

Created:
8 years, 8 months ago by Erik Corry
Modified:
8 years, 8 months ago
CC:
v8-dev
Visibility:
Public.

Description

Regexp: Fix rightContext in the lastMatchInfoOverride case. Committed: http://code.google.com/p/v8/source/detail?r=11285

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -2 lines) Patch
M src/regexp.js View 1 chunk +3 lines, -2 lines 2 comments Download
A test/mjsunit/regexp-capture-3.js View 1 chunk +30 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Erik Corry
8 years, 8 months ago (2012-04-12 11:58:02 UTC) #1
Michael Starzinger
LGTM (with a nit). http://codereview.chromium.org/10068010/diff/1/src/regexp.js File src/regexp.js (right): http://codereview.chromium.org/10068010/diff/1/src/regexp.js#newcode346 src/regexp.js:346: var subject, pattern; The "pattern" ...
8 years, 8 months ago (2012-04-12 12:10:28 UTC) #2
Lasse Reichstein Nielsen
8 years, 8 months ago (2012-04-13 06:59:52 UTC) #3
http://codereview.chromium.org/10068010/diff/1/src/regexp.js
File src/regexp.js (right):

http://codereview.chromium.org/10068010/diff/1/src/regexp.js#newcode353
src/regexp.js:353: pattern = override[override.length - 3];
I don't think this is correct in all cases.

The override has the same format as the parameters to a function argument of
String.prototype.replace. I.e., it's 
[match, captures*, match-position, subject].

So 'pattern' should probably be called 'match', and it should be read as
override[0], not override[override.length - 3], in the cases where there are
captures.

You might want to consider making macros like

 macro OVERRIDE_MATCH(override) = ((override)[0]);
 macro OVERRIDE_POS(override) = ((override)[(override).length - 2]);
 macro OVERRIDE_SUBJECT(override) = ((override)[(override).length - 1]);
 macro OVERRIDE_CAPTURE(override, index) = ((override)[(index) + 1]);

(if for nothing else, it's documentation :)

Powered by Google App Engine
This is Rietveld 408576698