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

Side by Side Diff: sdk/lib/_internal/lib/core_patch.dart

Issue 75703002: Revert "This change makes it easier to put type parameters on JavaScript Arrays." (Closed) Base URL: https://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 file for dart:core classes. 5 // Patch file for dart:core classes.
6 import "dart:_collection-dev" as _symbol_dev; 6 import "dart:_collection-dev" as _symbol_dev;
7 import 'dart:_interceptors'; 7 import 'dart:_interceptors';
8 import 'dart:_js_helper' show checkNull, 8 import 'dart:_js_helper' show checkNull,
9 getRuntimeType, 9 getRuntimeType,
10 JSSyntaxRegExp, 10 JSSyntaxRegExp,
11 Primitives, 11 Primitives,
12 stringJoinUnchecked, 12 stringJoinUnchecked,
13 objectHashCode; 13 objectHashCode;
14 import 'dart:_js_primitives' show
15 newFixedList,
16 newGrowableList;
14 17
15 String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol); 18 String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
16 19
17 _symbolMapToStringMap(Map<Symbol, dynamic> map) { 20 _symbolMapToStringMap(Map<Symbol, dynamic> map) {
18 if (map == null) return null; 21 if (map == null) return null;
19 var result = new Map<String, dynamic>(); 22 var result = new Map<String, dynamic>();
20 map.forEach((Symbol key, value) { 23 map.forEach((Symbol key, value) {
21 result[_symbolToString(key)] = value; 24 result[_symbolToString(key)] = value;
22 }); 25 });
23 return result; 26 return result;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Patch for Stopwatch implementation. 186 // Patch for Stopwatch implementation.
184 patch class Stopwatch { 187 patch class Stopwatch {
185 patch static int _frequency() => 1000000; 188 patch static int _frequency() => 1000000;
186 patch static int _now() => Primitives.numMicroseconds(); 189 patch static int _now() => Primitives.numMicroseconds();
187 } 190 }
188 191
189 192
190 // Patch for List implementation. 193 // Patch for List implementation.
191 patch class List<E> { 194 patch class List<E> {
192 patch factory List([int length]) { 195 patch factory List([int length]) {
193 if (length == null) return new JSArray<E>.emptyGrowable(); 196 if (length == null) return newGrowableList(0);
194 return new JSArray<E>.fixed(length); 197 // Explicit type test is necessary to protect [newFixedList] in
198 // unchecked mode.
199 if ((length is !int) || (length < 0)) {
200 throw new ArgumentError("Length must be a positive integer: $length.");
201 }
202 return newFixedList(length);
195 } 203 }
196 204
197 patch factory List.filled(int length, E fill) { 205 patch factory List.filled(int length, E fill) {
198 List result = new JSArray<E>.fixed(length); 206 // Explicit type test is necessary to protect [newFixedList] in
207 // unchecked mode.
208 if ((length is !int) || (length < 0)) {
209 throw new ArgumentError("Length must be a positive integer: $length.");
210 }
211 List result = newFixedList(length);
199 if (length != 0 && fill != null) { 212 if (length != 0 && fill != null) {
200 for (int i = 0; i < result.length; i++) { 213 for (int i = 0; i < result.length; i++) {
201 result[i] = fill; 214 result[i] = fill;
202 } 215 }
203 } 216 }
204 return result; 217 return result;
205 } 218 }
206 } 219 }
207 220
208 221
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 331
319 patch class Uri { 332 patch class Uri {
320 patch static bool get _isWindows => false; 333 patch static bool get _isWindows => false;
321 334
322 patch static Uri get base { 335 patch static Uri get base {
323 String uri = Primitives.currentUri(); 336 String uri = Primitives.currentUri();
324 if (uri != null) return Uri.parse(uri); 337 if (uri != null) return Uri.parse(uri);
325 throw new UnsupportedError("'Uri.base' is not supported"); 338 throw new UnsupportedError("'Uri.base' is not supported");
326 } 339 }
327 } 340 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/lib/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698