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

Side by Side Diff: src/string.js

Issue 4483001: Fix issue 924 - splitting the empty string. (Closed)
Patch Set: Created 10 years, 1 month 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/string-split.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 var result = %StringSplit(subject, separator, limit); 560 var result = %StringSplit(subject, separator, limit);
561 561
562 return result; 562 return result;
563 } 563 }
564 564
565 var saveAnswer = false; 565 var saveAnswer = false;
566 566
567 %_Log('regexp', 'regexp-split,%0S,%1r', [subject, separator]); 567 %_Log('regexp', 'regexp-split,%0S,%1r', [subject, separator]);
568 568
569 if (length === 0) { 569 if (length === 0) {
570 if (splitMatch(separator, subject, 0, 0) != null) { 570 if (DoRegExpExec(separator, subject, 0, 0) != null) {
571 return []; 571 return [];
572 } 572 }
573 return [subject]; 573 return [subject];
574 } 574 }
575 575
576 var currentIndex = 0; 576 var currentIndex = 0;
577 var startIndex = 0; 577 var startIndex = 0;
578 var result = []; 578 var result = [];
579 579
580 outer_loop: 580 outer_loop:
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 "small", StringSmall, 934 "small", StringSmall,
935 "strike", StringStrike, 935 "strike", StringStrike,
936 "sub", StringSub, 936 "sub", StringSub,
937 "sup", StringSup, 937 "sup", StringSup,
938 "toJSON", StringToJSON 938 "toJSON", StringToJSON
939 )); 939 ));
940 } 940 }
941 941
942 942
943 SetupString(); 943 SetupString();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/string-split.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698