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

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

Issue 1188103002: Do not mark type variables as needing a box inside try; they are immutable. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | pkg/compiler/lib/src/ssa/builder.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) 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 'constants/expressions.dart'; 7 import 'constants/expressions.dart';
8 import 'dart2jslib.dart'; 8 import 'dart2jslib.dart';
9 import 'dart_types.dart'; 9 import 'dart_types.dart';
10 import 'elements/elements.dart'; 10 import 'elements/elements.dart';
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 variable.executableContext == executableContext; 644 variable.executableContext == executableContext;
645 } 645 }
646 646
647 if (insideClosure && !inCurrentContext(variable)) { 647 if (insideClosure && !inCurrentContext(variable)) {
648 closureData.addFreeVariable(variable); 648 closureData.addFreeVariable(variable);
649 } else if (inTryStatement) { 649 } else if (inTryStatement) {
650 // Don't mark the this-element or a self-reference. This would complicate 650 // Don't mark the this-element or a self-reference. This would complicate
651 // things in the builder. 651 // things in the builder.
652 // Note that nested (named) functions are immutable. 652 // Note that nested (named) functions are immutable.
653 if (variable != closureData.thisLocal && 653 if (variable != closureData.thisLocal &&
654 variable != closureData.closureElement) { 654 variable != closureData.closureElement &&
655 variable is! TypeVariableLocal) {
655 closureData.variablesUsedInTryOrGenerator.add(variable); 656 closureData.variablesUsedInTryOrGenerator.add(variable);
656 } 657 }
657 } else if (variable is LocalParameterElement && 658 } else if (variable is LocalParameterElement &&
658 variable.functionDeclaration.asyncMarker == AsyncMarker.SYNC_STAR) { 659 variable.functionDeclaration.asyncMarker == AsyncMarker.SYNC_STAR) {
659 // Parameters in a sync* function are shared between each Iterator created 660 // Parameters in a sync* function are shared between each Iterator created
660 // by the Iterable returned by the function, therefore they must be boxed. 661 // by the Iterable returned by the function, therefore they must be boxed.
661 closureData.variablesUsedInTryOrGenerator.add(variable); 662 closureData.variablesUsedInTryOrGenerator.add(variable);
662 } 663 }
663 } 664 }
664 665
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 1112
1112 String get name => typeVariable.name; 1113 String get name => typeVariable.name;
1113 1114
1114 int get hashCode => typeVariable.hashCode; 1115 int get hashCode => typeVariable.hashCode;
1115 1116
1116 bool operator ==(other) { 1117 bool operator ==(other) {
1117 if (other is! TypeVariableLocal) return false; 1118 if (other is! TypeVariableLocal) return false;
1118 return typeVariable == other.typeVariable; 1119 return typeVariable == other.typeVariable;
1119 } 1120 }
1120 } 1121 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698