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

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

Issue 1051223003: dartj2s: add constructor helpers for map literals with no type parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added comment. 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 | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/mock_libraries.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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:collection classes. 5 // Patch file for dart:collection classes.
6 import 'dart:_foreign_helper' show JS; 6 import 'dart:_foreign_helper' show JS;
7 import 'dart:_js_helper' show 7 import 'dart:_js_helper' show
8 fillLiteralMap, InternalMap, NoInline, NoThrows, patch, JsLinkedHashMap, 8 fillLiteralMap, InternalMap, NoInline, NoThrows, patch, JsLinkedHashMap,
9 LinkedHashMapCell, LinkedHashMapKeyIterable, LinkedHashMapKeyIterator; 9 LinkedHashMapCell, LinkedHashMapKeyIterable, LinkedHashMapKeyIterator;
10 10
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 @NoInline() 522 @NoInline()
523 factory LinkedHashMap._literal(List keyValuePairs) { 523 factory LinkedHashMap._literal(List keyValuePairs) {
524 return fillLiteralMap(keyValuePairs, new JsLinkedHashMap<K, V>()); 524 return fillLiteralMap(keyValuePairs, new JsLinkedHashMap<K, V>());
525 } 525 }
526 526
527 // Private factory constructor called by generated code for map literals. 527 // Private factory constructor called by generated code for map literals.
528 @NoThrows() @NoInline() 528 @NoThrows() @NoInline()
529 factory LinkedHashMap._empty() { 529 factory LinkedHashMap._empty() {
530 return new JsLinkedHashMap<K, V>(); 530 return new JsLinkedHashMap<K, V>();
531 } 531 }
532
533 // Private factory static function called by generated code for map literals.
534 // This version is for map literals without type parameters.
535 @NoInline()
536 static _makeEmpty() => new JsLinkedHashMap();
537
538 // Private factory static function called by generated code for map literals.
539 // This version is for map literals without type parameters.
540 @NoInline()
541 static _makeLiteral(keyValuePairs) =>
542 fillLiteralMap(keyValuePairs, new JsLinkedHashMap());
532 } 543 }
533 544
534 class _LinkedIdentityHashMap<K, V> extends JsLinkedHashMap<K, V> { 545 class _LinkedIdentityHashMap<K, V> extends JsLinkedHashMap<K, V> {
535 int internalComputeHashCode(var key) { 546 int internalComputeHashCode(var key) {
536 // We force the hash codes to be unsigned 30-bit integers to avoid 547 // We force the hash codes to be unsigned 30-bit integers to avoid
537 // issues with problematic keys like '__proto__'. Another option 548 // issues with problematic keys like '__proto__'. Another option
538 // would be to throw an exception if the hash code isn't a number. 549 // would be to throw an exception if the hash code isn't a number.
539 return JS('int', '# & 0x3ffffff', identityHashCode(key)); 550 return JS('int', '# & 0x3ffffff', identityHashCode(key));
540 } 551 }
541 552
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 } else if (_cell == null) { 1469 } else if (_cell == null) {
1459 _current = null; 1470 _current = null;
1460 return false; 1471 return false;
1461 } else { 1472 } else {
1462 _current = _cell._element; 1473 _current = _cell._element;
1463 _cell = _cell._next; 1474 _cell = _cell._next;
1464 return true; 1475 return true;
1465 } 1476 }
1466 } 1477 }
1467 } 1478 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/mock_libraries.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698