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

Side by Side Diff: pkg/analyzer/lib/src/generated/utilities_collection.dart

Issue 1151723002: Don't get value in SingleMapIterator until it is requested. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.utilities.collection; 8 library engine.utilities.collection;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 throw new NoSuchElementException(); 674 throw new NoSuchElementException();
675 } 675 }
676 return _currentKey; 676 return _currentKey;
677 } 677 }
678 678
679 @override 679 @override
680 V get value { 680 V get value {
681 if (_currentKey == null) { 681 if (_currentKey == null) {
682 throw new NoSuchElementException(); 682 throw new NoSuchElementException();
683 } 683 }
684 if (_currentValue == null) {
685 _currentValue = _map[_currentKey];
686 }
684 return _currentValue; 687 return _currentValue;
685 } 688 }
686 689
687 @override 690 @override
688 void set value(V newValue) { 691 void set value(V newValue) {
689 if (_currentKey == null) { 692 if (_currentKey == null) {
690 throw new NoSuchElementException(); 693 throw new NoSuchElementException();
691 } 694 }
692 _currentValue = newValue; 695 _currentValue = newValue;
693 _map[_currentKey] = newValue; 696 _map[_currentKey] = newValue;
694 } 697 }
695 698
696 @override 699 @override
697 bool moveNext() { 700 bool moveNext() {
698 if (_keyIterator.moveNext()) { 701 if (_keyIterator.moveNext()) {
699 _currentKey = _keyIterator.current; 702 _currentKey = _keyIterator.current;
700 _currentValue = _map[_currentKey]; 703 _currentValue = null;
701 return true; 704 return true;
702 } else { 705 } else {
703 _currentKey = null; 706 _currentKey = null;
704 return false; 707 return false;
705 } 708 }
706 } 709 }
707 710
708 /** 711 /**
709 * Returns a new [SingleMapIterator] instance for the given [Map]. 712 * Returns a new [SingleMapIterator] instance for the given [Map].
710 */ 713 */
(...skipping 23 matching lines...) Expand all
734 /** 737 /**
735 * Map the key to the value. 738 * Map the key to the value.
736 * 739 *
737 * @param key the token being mapped to the value 740 * @param key the token being mapped to the value
738 * @param value the token to which the key will be mapped 741 * @param value the token to which the key will be mapped
739 */ 742 */
740 void put(Token key, Token value) { 743 void put(Token key, Token value) {
741 _map[key] = value; 744 _map[key] = value;
742 } 745 }
743 } 746 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698