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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2931773003: Add flutter mode to patched_sdk (Closed)
Patch Set: address cl comments and merge conflicts Created 3 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 | « pkg/front_end/lib/src/fasta/dill/dill_loader.dart ('k') | pkg/kernel/lib/target/flutter.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show 8 show
9 FastaMessage, 9 FastaMessage,
10 codeConstFieldWithoutInitializer, 10 codeConstFieldWithoutInitializer,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 final ClassHierarchy hierarchy; 85 final ClassHierarchy hierarchy;
86 86
87 final CoreTypes coreTypes; 87 final CoreTypes coreTypes;
88 88
89 final bool isInstanceMember; 89 final bool isInstanceMember;
90 90
91 final Scope enclosingScope; 91 final Scope enclosingScope;
92 92
93 final bool enableNative; 93 final bool enableNative;
94 94
95 final bool isBuiltinLibrary; 95 /// Whether to ignore an unresolved reference to `main` within the body of
96 /// `_getMainClosure` when compiling the current library.
97 ///
98 /// This as a temporary workaround. The standalone VM and flutter have
99 /// special logic to resolve `main` in `_getMainClosure`, this flag is used to
100 /// ignore that reference to `main`, but only on libraries where we expect to
101 /// see it (today that is dart:_builtin and dart:ui).
102 ///
103 // TODO(ahe,sigmund): remove when the VM gets rid of the special rule, see
104 // https://github.com/dart-lang/sdk/issues/28989.
105 final bool ignoreMainInGetMainClosure;
96 106
97 @override 107 @override
98 final Uri uri; 108 final Uri uri;
99 109
100 final TypeInferrer _typeInferrer; 110 final TypeInferrer _typeInferrer;
101 111
102 @override 112 @override
103 final TypePromoter typePromoter; 113 final TypePromoter typePromoter;
104 114
105 /// Only used when [member] is a constructor. It tracks if an implicit super 115 /// Only used when [member] is a constructor. It tracks if an implicit super
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 this.formalParameterScope, 172 this.formalParameterScope,
163 this.hierarchy, 173 this.hierarchy,
164 this.coreTypes, 174 this.coreTypes,
165 this.classBuilder, 175 this.classBuilder,
166 this.isInstanceMember, 176 this.isInstanceMember,
167 this.uri, 177 this.uri,
168 this._typeInferrer) 178 this._typeInferrer)
169 : enclosingScope = scope, 179 : enclosingScope = scope,
170 library = library, 180 library = library,
171 enableNative = library.loader.target.enableNative(library), 181 enableNative = library.loader.target.enableNative(library),
172 isBuiltinLibrary = 182 ignoreMainInGetMainClosure = library.uri.scheme == 'dart' &&
173 library.uri.scheme == 'dart' && library.uri.path == "_builtin", 183 (library.uri.path == "_builtin" || library.uri.path == "ui"),
174 needsImplicitSuperInitializer = 184 needsImplicitSuperInitializer =
175 coreTypes.objectClass != classBuilder?.cls, 185 coreTypes.objectClass != classBuilder?.cls,
176 typePromoter = _typeInferrer.typePromoter, 186 typePromoter = _typeInferrer.typePromoter,
177 super(scope); 187 super(scope);
178 188
179 bool get hasParserError => recoverableErrors.isNotEmpty; 189 bool get hasParserError => recoverableErrors.isNotEmpty;
180 190
181 bool get inConstructor { 191 bool get inConstructor {
182 return functionNestingLevel == 0 && member is KernelConstructorBuilder; 192 return functionNestingLevel == 0 && member is KernelConstructorBuilder;
183 } 193 }
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 // a program that uses deferred loading. Obviously, this is a temporary 1084 // a program that uses deferred loading. Obviously, this is a temporary
1075 // solution until we can fully implement deferred loading. 1085 // solution until we can fully implement deferred loading.
1076 addCompileTimeError(offset, message, wasHandled: false, silent: true); 1086 addCompileTimeError(offset, message, wasHandled: false, silent: true);
1077 return buildCompileTimeError(message, offset); 1087 return buildCompileTimeError(message, offset);
1078 } else if (!isQualified && isInstanceContext) { 1088 } else if (!isQualified && isInstanceContext) {
1079 assert(builder == null); 1089 assert(builder == null);
1080 if (constantExpressionRequired || member.isField) { 1090 if (constantExpressionRequired || member.isField) {
1081 return new UnresolvedAccessor(this, n, token); 1091 return new UnresolvedAccessor(this, n, token);
1082 } 1092 }
1083 return new ThisPropertyAccessor(this, token, n, null, null); 1093 return new ThisPropertyAccessor(this, token, n, null, null);
1084 } else if (isBuiltinLibrary && 1094 } else if (ignoreMainInGetMainClosure &&
1085 name == "main" && 1095 name == "main" &&
1086 member?.name == "_getMainClosure") { 1096 member?.name == "_getMainClosure") {
1087 // TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
1088 return new KernelNullLiteral()..fileOffset = offsetForToken(token); 1097 return new KernelNullLiteral()..fileOffset = offsetForToken(token);
1089 } else { 1098 } else {
1090 return new UnresolvedAccessor(this, n, token); 1099 return new UnresolvedAccessor(this, n, token);
1091 } 1100 }
1092 } else if (builder.isTypeDeclaration) { 1101 } else if (builder.isTypeDeclaration) {
1093 if (constantExpressionRequired && 1102 if (constantExpressionRequired &&
1094 builder.isTypeVariable && 1103 builder.isTypeVariable &&
1095 !member.isConstructor) { 1104 !member.isConstructor) {
1096 addCompileTimeError( 1105 addCompileTimeError(
1097 offsetForToken(token), "Not a constant expression."); 1106 offsetForToken(token), "Not a constant expression.");
(...skipping 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after
3658 if (starToken == null) { 3667 if (starToken == null) {
3659 return AsyncMarker.Async; 3668 return AsyncMarker.Async;
3660 } else { 3669 } else {
3661 assert(identical(starToken.stringValue, "*")); 3670 assert(identical(starToken.stringValue, "*"));
3662 return AsyncMarker.AsyncStar; 3671 return AsyncMarker.AsyncStar;
3663 } 3672 }
3664 } else { 3673 } else {
3665 return internalError("Unknown async modifier: $asyncToken"); 3674 return internalError("Unknown async modifier: $asyncToken");
3666 } 3675 }
3667 } 3676 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_loader.dart ('k') | pkg/kernel/lib/target/flutter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698