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

Side by Side Diff: runtime/lib/string_patch.dart

Issue 51533003: Compile time error if name is used before variable is declared (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 patch class String { 5 patch class String {
6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) {
7 return _StringBase.createFromCharCodes(charCodes); 7 return _StringBase.createFromCharCodes(charCodes);
8 } 8 }
9 9
10 /* patch */ const factory String.fromEnvironment(String name, 10 /* patch */ const factory String.fromEnvironment(String name,
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 for (int i = 0; i < this.length; i++) { 461 for (int i = 0; i < this.length; i++) {
462 if (string.codeUnitAt(start + i) != this.codeUnitAt(i)) { 462 if (string.codeUnitAt(start + i) != this.codeUnitAt(i)) {
463 return null; 463 return null;
464 } 464 }
465 } 465 }
466 return new _StringMatch(start, string, this); 466 return new _StringMatch(start, string, this);
467 } 467 }
468 468
469 List<String> split(Pattern pattern) { 469 List<String> split(Pattern pattern) {
470 if ((pattern is String) && pattern.isEmpty) { 470 if ((pattern is String) && pattern.isEmpty) {
471 List<String> result = new List<String>(length); 471 List<String> result = new List<String>(this.length);
472 for (int i = 0; i < length; i++) { 472 for (int i = 0; i < this.length; i++) {
473 result[i] = this[i]; 473 result[i] = this[i];
474 } 474 }
475 return result; 475 return result;
476 } 476 }
477 int length = this.length; 477 int length = this.length;
478 Iterator iterator = pattern.allMatches(this).iterator; 478 Iterator iterator = pattern.allMatches(this).iterator;
479 if (length == 0 && iterator.moveNext()) { 479 if (length == 0 && iterator.moveNext()) {
480 // A matched empty string input returns the empty list. 480 // A matched empty string input returns the empty list.
481 return <String>[]; 481 return <String>[];
482 } 482 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 class _CodeUnits extends Object with ListMixin<int>, 701 class _CodeUnits extends Object with ListMixin<int>,
702 UnmodifiableListMixin<int> { 702 UnmodifiableListMixin<int> {
703 /** The string that this is the code units of. */ 703 /** The string that this is the code units of. */
704 String _string; 704 String _string;
705 705
706 _CodeUnits(this._string); 706 _CodeUnits(this._string);
707 707
708 int get length => _string.length; 708 int get length => _string.length;
709 int operator[](int i) => _string.codeUnitAt(i); 709 int operator[](int i) => _string.codeUnitAt(i);
710 } 710 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698