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

Side by Side Diff: src/js/regexp.js

Issue 1688163003: [regexp] Fix RegExp.prototype.toString. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | test/mjsunit/es6/regexp-tostring.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // a UseCounter is incremented to track it. 275 // a UseCounter is incremented to track it.
276 // TODO(littledan): Remove this workaround or standardize it 276 // TODO(littledan): Remove this workaround or standardize it
277 if (this === GlobalRegExpPrototype) { 277 if (this === GlobalRegExpPrototype) {
278 %IncrementUseCounter(kRegExpPrototypeToString); 278 %IncrementUseCounter(kRegExpPrototypeToString);
279 return '/(?:)/'; 279 return '/(?:)/';
280 } 280 }
281 if (!IS_RECEIVER(this)) { 281 if (!IS_RECEIVER(this)) {
282 throw MakeTypeError( 282 throw MakeTypeError(
283 kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this); 283 kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this);
284 } 284 }
285 return '/' + TO_STRING(this.pattern()) + '/' + TO_STRING(this.flags()); 285 return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags);
286 } 286 }
287 var result = '/' + REGEXP_SOURCE(this) + '/'; 287 var result = '/' + REGEXP_SOURCE(this) + '/';
288 if (REGEXP_GLOBAL(this)) result += 'g'; 288 if (REGEXP_GLOBAL(this)) result += 'g';
289 if (REGEXP_IGNORE_CASE(this)) result += 'i'; 289 if (REGEXP_IGNORE_CASE(this)) result += 'i';
290 if (REGEXP_MULTILINE(this)) result += 'm'; 290 if (REGEXP_MULTILINE(this)) result += 'm';
291 if (REGEXP_UNICODE(this)) result += 'u'; 291 if (REGEXP_UNICODE(this)) result += 'u';
292 if (REGEXP_STICKY(this)) result += 'y'; 292 if (REGEXP_STICKY(this)) result += 'y';
293 return result; 293 return result;
294 } 294 }
295 295
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 // Exports 753 // Exports
754 754
755 utils.Export(function(to) { 755 utils.Export(function(to) {
756 to.RegExpExec = DoRegExpExec; 756 to.RegExpExec = DoRegExpExec;
757 to.RegExpExecNoTests = RegExpExecNoTests; 757 to.RegExpExecNoTests = RegExpExecNoTests;
758 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 758 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
759 to.RegExpTest = RegExpTest; 759 to.RegExpTest = RegExpTest;
760 }); 760 });
761 761
762 }) 762 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/regexp-tostring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698