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

Side by Side Diff: pkg/compiler/lib/src/closure.dart

Issue 964553004: Analyze locals in await for loops as inside a try-finally. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
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 library closureToClassMapper; 5 library closureToClassMapper;
6 6
7 import "elements/elements.dart"; 7 import "elements/elements.dart";
8 import "dart2jslib.dart"; 8 import "dart2jslib.dart";
9 import "dart_types.dart"; 9 import "dart_types.dart";
10 import "js_backend/js_backend.dart" show JavaScriptBackend; 10 import "js_backend/js_backend.dart" show JavaScriptBackend;
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 }); 1021 });
1022 } 1022 }
1023 1023
1024 visitTryStatement(TryStatement node) { 1024 visitTryStatement(TryStatement node) {
1025 // TODO(ngeoffray): implement finer grain state. 1025 // TODO(ngeoffray): implement finer grain state.
1026 bool oldInTryStatement = inTryStatement; 1026 bool oldInTryStatement = inTryStatement;
1027 inTryStatement = true; 1027 inTryStatement = true;
1028 node.visitChildren(this); 1028 node.visitChildren(this);
1029 inTryStatement = oldInTryStatement; 1029 inTryStatement = oldInTryStatement;
1030 } 1030 }
1031
1032 visitForIn(ForIn node) {
1033 if (node.awaitToken != null) {
1034 // An `await for` loop is enclosed in an implicit try-finally.
1035 bool oldInTryStatement = inTryStatement;
1036 inTryStatement = true;
1037 node.visitChildren(this);
1038 inTryStatement = oldInTryStatement;
1039 } else {
1040 node.visitChildren(this);
1041 }
1042 }
1031 } 1043 }
1032 1044
1033 /// A type variable as a local variable. 1045 /// A type variable as a local variable.
1034 class TypeVariableLocal implements Local { 1046 class TypeVariableLocal implements Local {
1035 final TypeVariableType typeVariable; 1047 final TypeVariableType typeVariable;
1036 final ExecutableElement executableContext; 1048 final ExecutableElement executableContext;
1037 1049
1038 TypeVariableLocal(this.typeVariable, this.executableContext); 1050 TypeVariableLocal(this.typeVariable, this.executableContext);
1039 1051
1040 String get name => typeVariable.name; 1052 String get name => typeVariable.name;
1041 1053
1042 int get hashCode => typeVariable.hashCode; 1054 int get hashCode => typeVariable.hashCode;
1043 1055
1044 bool operator ==(other) { 1056 bool operator ==(other) {
1045 if (other is! TypeVariableLocal) return false; 1057 if (other is! TypeVariableLocal) return false;
1046 return typeVariable == other.typeVariable; 1058 return typeVariable == other.typeVariable;
1047 } 1059 }
1048 } 1060 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | pkg/compiler/lib/src/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698