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

Side by Side Diff: test/generated_sdk/lib/_internal/compiler/js_lib/js_string.dart

Issue 1153003003: fixes #40, extension methods for primitive types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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
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 part of _interceptors; 5 part of _interceptors;
6 6
7 /** 7 /**
8 * The interceptor class for [String]. The compiler recognizes this 8 * The interceptor class for [String]. The compiler recognizes this
9 * class as an interceptor, and changes references to [:this:] to 9 * class as an interceptor, and changes references to [:this:] to
10 * actually use the receiver of the method, which is generated as an extra 10 * actually use the receiver of the method, which is generated as an extra
11 * argument added to each member. 11 * argument added to each member.
12 */ 12 */
13 @JsPeerInterface(name: 'String')
13 class JSString extends Interceptor implements String, JSIndexable { 14 class JSString extends Interceptor implements String, JSIndexable {
14 const JSString(); 15 const JSString();
15 16
16 int codeUnitAt(int index) { 17 int codeUnitAt(int index) {
17 if (index is !int) throw new ArgumentError(index); 18 if (index is !int) throw new ArgumentError(index);
18 if (index < 0) throw new RangeError.value(index); 19 if (index < 0) throw new RangeError.value(index);
19 if (index >= length) throw new RangeError.value(index); 20 if (index >= length) throw new RangeError.value(index);
20 return JS('JSUInt31', r'#.charCodeAt(#)', this, index); 21 return JS('JSUInt31', r'#.charCodeAt(#)', this, index);
21 } 22 }
22 23
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 */ 463 */
463 class _CodeUnits extends UnmodifiableListBase<int> { 464 class _CodeUnits extends UnmodifiableListBase<int> {
464 /** The string that this is the code units of. */ 465 /** The string that this is the code units of. */
465 String _string; 466 String _string;
466 467
467 _CodeUnits(this._string); 468 _CodeUnits(this._string);
468 469
469 int get length => _string.length; 470 int get length => _string.length;
470 int operator[](int i) => _string.codeUnitAt(i); 471 int operator[](int i) => _string.codeUnitAt(i);
471 } 472 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698