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

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

Issue 769533003: Mark empty HashMap constructor as NoThrows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added test Created 6 years 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 | « no previous file | tests/compiler/dart2js/unused_empty_map_test.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 fillLiteralMap, NoInline, patch; 7 import 'dart:_js_helper' show fillLiteralMap, NoInline, NoThrows, patch;
8 8
9 @patch 9 @patch
10 class HashMap<K, V> { 10 class HashMap<K, V> {
11 @patch 11 @patch
12 factory HashMap({ bool equals(K key1, K key2), 12 factory HashMap({ bool equals(K key1, K key2),
13 int hashCode(K key), 13 int hashCode(K key),
14 bool isValidKey(potentialKey) }) { 14 bool isValidKey(potentialKey) }) {
15 if (isValidKey == null) { 15 if (isValidKey == null) {
16 if (hashCode == null) { 16 if (hashCode == null) {
17 if (equals == null) { 17 if (equals == null) {
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 @patch 516 @patch
517 factory LinkedHashMap.identity() = _LinkedIdentityHashMap<K, V>; 517 factory LinkedHashMap.identity() = _LinkedIdentityHashMap<K, V>;
518 518
519 // Private factory constructor called by generated code for map literals. 519 // Private factory constructor called by generated code for map literals.
520 @NoInline() 520 @NoInline()
521 factory LinkedHashMap._literal(List keyValuePairs) { 521 factory LinkedHashMap._literal(List keyValuePairs) {
522 return fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>()); 522 return fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>());
523 } 523 }
524 524
525 // Private factory constructor called by generated code for map literals. 525 // Private factory constructor called by generated code for map literals.
526 @NoInline() 526 @NoThrows() @NoInline()
527 factory LinkedHashMap._empty() { 527 factory LinkedHashMap._empty() {
528 return new _LinkedHashMap<K, V>(); 528 return new _LinkedHashMap<K, V>();
529 } 529 }
530 } 530 }
531 531
532 class _LinkedHashMap<K, V> implements LinkedHashMap<K, V> { 532 class _LinkedHashMap<K, V> implements LinkedHashMap<K, V> {
533 int _length = 0; 533 int _length = 0;
534 534
535 // The hash map contents are divided into three parts: one part for 535 // The hash map contents are divided into three parts: one part for
536 // string keys, one for numeric keys, and one for the rest. String 536 // string keys, one for numeric keys, and one for the rest. String
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } else if (_cell == null) { 1828 } else if (_cell == null) {
1829 _current = null; 1829 _current = null;
1830 return false; 1830 return false;
1831 } else { 1831 } else {
1832 _current = _cell._element; 1832 _current = _cell._element;
1833 _cell = _cell._next; 1833 _cell = _cell._next;
1834 return true; 1834 return true;
1835 } 1835 }
1836 } 1836 }
1837 } 1837 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/unused_empty_map_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698