OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 5 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/src/generated/constant.dart'; | 10 import 'package:analyzer/src/generated/constant.dart'; |
(...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3199 // Like the Dart VM, we call cancel() always, as it's safe to call if the | 3199 // Like the Dart VM, we call cancel() always, as it's safe to call if the |
3200 // stream has already been cancelled. | 3200 // stream has already been cancelled. |
3201 // | 3201 // |
3202 // TODO(jmesserly): we may want a helper if these become common. For now the | 3202 // TODO(jmesserly): we may want a helper if these become common. For now the |
3203 // full desugaring seems okay. | 3203 // full desugaring seems okay. |
3204 var context = compiler.context; | 3204 var context = compiler.context; |
3205 var dart_async = context | 3205 var dart_async = context |
3206 .computeLibraryElement(context.sourceFactory.forUri('dart:async')); | 3206 .computeLibraryElement(context.sourceFactory.forUri('dart:async')); |
3207 var T = node.loopVariable.element.type; | 3207 var T = node.loopVariable.element.type; |
3208 var StreamIterator_T = | 3208 var StreamIterator_T = |
3209 dart_async.getType('StreamIterator').type.substitute4([T]); | 3209 dart_async.getType('StreamIterator').type.instantiate([T]); |
3210 | 3210 |
3211 var createStreamIter = _emitInstanceCreationExpression( | 3211 var createStreamIter = _emitInstanceCreationExpression( |
3212 StreamIterator_T.element.unnamedConstructor, | 3212 StreamIterator_T.element.unnamedConstructor, |
3213 StreamIterator_T, | 3213 StreamIterator_T, |
3214 null, | 3214 null, |
3215 AstBuilder.argumentList([node.iterable]), | 3215 AstBuilder.argumentList([node.iterable]), |
3216 false); | 3216 false); |
3217 var iter = | 3217 var iter = |
3218 _visit(_createTemporary('it', StreamIterator_T, nullable: false)); | 3218 _visit(_createTemporary('it', StreamIterator_T, nullable: false)); |
3219 | 3219 |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3843 | 3843 |
3844 /// A special kind of element created by the compiler, signifying a temporary | 3844 /// A special kind of element created by the compiler, signifying a temporary |
3845 /// variable. These objects use instance equality, and should be shared | 3845 /// variable. These objects use instance equality, and should be shared |
3846 /// everywhere in the tree where they are treated as the same variable. | 3846 /// everywhere in the tree where they are treated as the same variable. |
3847 class TemporaryVariableElement extends LocalVariableElementImpl { | 3847 class TemporaryVariableElement extends LocalVariableElementImpl { |
3848 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3848 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
3849 | 3849 |
3850 int get hashCode => identityHashCode(this); | 3850 int get hashCode => identityHashCode(this); |
3851 bool operator ==(Object other) => identical(this, other); | 3851 bool operator ==(Object other) => identical(this, other); |
3852 } | 3852 } |
OLD | NEW |