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

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

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/commandline_options.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 'common.dart'; 7 import 'common.dart';
8 import 'common/names.dart' show 8 import 'common/names.dart' show
9 Identifiers; 9 Identifiers;
10 import 'common/resolution.dart' show 10 import 'common/resolution.dart' show
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 736 }
737 } 737 }
738 } 738 }
739 739
740 visitTypeAnnotation(TypeAnnotation node) { 740 visitTypeAnnotation(TypeAnnotation node) {
741 MemberElement member = executableContext.memberContext; 741 MemberElement member = executableContext.memberContext;
742 DartType type = elements.getType(node); 742 DartType type = elements.getType(node);
743 // TODO(karlklose,johnniwinther): if the type is null, the annotation is 743 // TODO(karlklose,johnniwinther): if the type is null, the annotation is
744 // from a parameter which has been analyzed before the method has been 744 // from a parameter which has been analyzed before the method has been
745 // resolved and the result has been thrown away. 745 // resolved and the result has been thrown away.
746 if (compiler.enableTypeAssertions && type != null && 746 if (compiler.options.enableTypeAssertions && type != null &&
747 type.containsTypeVariables) { 747 type.containsTypeVariables) {
748 if (insideClosure && member.isFactoryConstructor) { 748 if (insideClosure && member.isFactoryConstructor) {
749 // This is a closure in a factory constructor. Since there is no 749 // This is a closure in a factory constructor. Since there is no
750 // [:this:], we have to mark the type arguments as free variables to 750 // [:this:], we have to mark the type arguments as free variables to
751 // capture them in the closure. 751 // capture them in the closure.
752 type.forEachTypeVariable((TypeVariableType variable) { 752 type.forEachTypeVariable((TypeVariableType variable) {
753 useTypeVariableAsLocal(variable); 753 useTypeVariableAsLocal(variable);
754 }); 754 });
755 } 755 }
756 if (member.isInstanceMember && !member.isField) { 756 if (member.isInstanceMember && !member.isField) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 DartType type = elements.getType(node.arguments.head); 806 DartType type = elements.getType(node.arguments.head);
807 analyzeType(type); 807 analyzeType(type);
808 } 808 }
809 node.visitChildren(this); 809 node.visitChildren(this);
810 } 810 }
811 811
812 visitSendSet(SendSet node) { 812 visitSendSet(SendSet node) {
813 Element element = elements[node]; 813 Element element = elements[node];
814 if (Elements.isLocal(element)) { 814 if (Elements.isLocal(element)) {
815 mutatedVariables.add(element); 815 mutatedVariables.add(element);
816 if (compiler.enableTypeAssertions) { 816 if (compiler.options.enableTypeAssertions) {
817 TypedElement typedElement = element; 817 TypedElement typedElement = element;
818 analyzeTypeVariables(typedElement.type); 818 analyzeTypeVariables(typedElement.type);
819 } 819 }
820 } 820 }
821 super.visitSendSet(node); 821 super.visitSendSet(node);
822 } 822 }
823 823
824 visitNewExpression(NewExpression node) { 824 visitNewExpression(NewExpression node) {
825 DartType type = elements.getType(node); 825 DartType type = elements.getType(node);
826 analyzeType(type); 826 analyzeType(type);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 closureData = new ClosureClassMap(null, null, null, thisElement); 1058 closureData = new ClosureClassMap(null, null, null, thisElement);
1059 } 1059 }
1060 closureMappingCache[node] = closureData; 1060 closureMappingCache[node] = closureData;
1061 1061
1062 inNewScope(node, () { 1062 inNewScope(node, () {
1063 DartType type = element.type; 1063 DartType type = element.type;
1064 // If the method needs RTI, or checked mode is set, we need to 1064 // If the method needs RTI, or checked mode is set, we need to
1065 // escape the potential type variables used in that closure. 1065 // escape the potential type variables used in that closure.
1066 if (element is FunctionElement && 1066 if (element is FunctionElement &&
1067 (compiler.backend.methodNeedsRti(element) || 1067 (compiler.backend.methodNeedsRti(element) ||
1068 compiler.enableTypeAssertions)) { 1068 compiler.options.enableTypeAssertions)) {
1069 analyzeTypeVariables(type); 1069 analyzeTypeVariables(type);
1070 } 1070 }
1071 1071
1072 visitChildren(); 1072 visitChildren();
1073 }); 1073 });
1074 1074
1075 1075
1076 ClosureClassMap savedClosureData = closureData; 1076 ClosureClassMap savedClosureData = closureData;
1077 bool savedInsideClosure = insideClosure; 1077 bool savedInsideClosure = insideClosure;
1078 1078
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 /// 1157 ///
1158 /// Move the below classes to a JS model eventually. 1158 /// Move the below classes to a JS model eventually.
1159 /// 1159 ///
1160 abstract class JSEntity implements Entity { 1160 abstract class JSEntity implements Entity {
1161 Entity get declaredEntity; 1161 Entity get declaredEntity;
1162 } 1162 }
1163 1163
1164 abstract class PrivatelyNamedJSEntity implements JSEntity { 1164 abstract class PrivatelyNamedJSEntity implements JSEntity {
1165 Entity get rootOfScope; 1165 Entity get rootOfScope;
1166 } 1166 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/commandline_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698