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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_array.dart

Issue 1076013006: Improve return type of markUnmodifiableList to JSArray instead of List. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix bad change. Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « CHANGELOG.md ('k') | sdk/lib/internal/list.dart » ('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 (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 [List]. The compiler recognizes this 8 * The interceptor class for [List]. 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
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 JS('void', r'#.fixed$length = Array', list); 76 JS('void', r'#.fixed$length = Array', list);
77 return JS('JSFixedArray', '#', list); 77 return JS('JSFixedArray', '#', list);
78 } 78 }
79 79
80 static List markUnmodifiableList(List list) { 80 static List markUnmodifiableList(List list) {
81 // Functions are stored in the hidden class and not as properties in 81 // Functions are stored in the hidden class and not as properties in
82 // the object. We never actually look at the value, but only want 82 // the object. We never actually look at the value, but only want
83 // to know if the property exists. 83 // to know if the property exists.
84 JS('void', r'#.fixed$length = Array', list); 84 JS('void', r'#.fixed$length = Array', list);
85 JS('void', r'#.immutable$list = Array', list); 85 JS('void', r'#.immutable$list = Array', list);
86 return JS('List', '#', list); 86 // TODO(23309): Make it detectable that the list has fixed length.
87 return JS('JSArray', '#', list);
87 } 88 }
88 89
89 checkMutable(reason) { 90 checkMutable(reason) {
90 if (this is !JSMutableArray) { 91 if (this is !JSMutableArray) {
91 throw new UnsupportedError(reason); 92 throw new UnsupportedError(reason);
92 } 93 }
93 } 94 }
94 95
95 checkGrowable(reason) { 96 checkGrowable(reason) {
96 if (this is !JSExtendableArray) { 97 if (this is !JSExtendableArray) {
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 640
640 if (_index >= length) { 641 if (_index >= length) {
641 _current = null; 642 _current = null;
642 return false; 643 return false;
643 } 644 }
644 _current = _iterable[_index]; 645 _current = _iterable[_index];
645 _index++; 646 _index++;
646 return true; 647 return true;
647 } 648 }
648 } 649 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | sdk/lib/internal/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698