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

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: 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
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 FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; 8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody;
9 9
10 import '../parser/parser.dart' 10 import '../parser/parser.dart'
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 final ClassHierarchy hierarchy; 76 final ClassHierarchy hierarchy;
77 77
78 final CoreTypes coreTypes; 78 final CoreTypes coreTypes;
79 79
80 final bool isInstanceMember; 80 final bool isInstanceMember;
81 81
82 final Scope enclosingScope; 82 final Scope enclosingScope;
83 83
84 final bool enableNative; 84 final bool enableNative;
85 85
86 final bool isBuiltinLibrary; 86 /// Whether to ignore an unresolved reference to `main` within the body of
87 /// `_getMainClosure` when compiling the current library.
88 ///
89 /// This as a temporary workaround. The standalone VM and flutter have
90 /// special logic to resolve `main` in `_getMainClosure`, this flag is used to
91 /// ignore that reference to `main`, but only on libraries where we expect to
92 /// see it (today that is dart:_builtin and dart:ui).
93 ///
94 // TODO(ahe,sigmund): remove when the VM gets rid of the special rule, see
95 // https://github.com/dart-lang/sdk/issues/28989.
96 final bool ignoreMainInGetMainClosure;
Siggi Cherem (dart-lang) 2017/06/08 22:18:53 Peter - I don't think it is worth moving this into
ahe 2017/06/09 09:23:35 Agreed.
87 97
88 @override 98 @override
89 final Uri uri; 99 final Uri uri;
90 100
91 final TypeInferrer _typeInferrer; 101 final TypeInferrer _typeInferrer;
92 102
93 @override 103 @override
94 final TypePromoter typePromoter; 104 final TypePromoter typePromoter;
95 105
96 /// Only used when [member] is a constructor. It tracks if an implicit super 106 /// 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
153 this.formalParameterScope, 163 this.formalParameterScope,
154 this.hierarchy, 164 this.hierarchy,
155 this.coreTypes, 165 this.coreTypes,
156 this.classBuilder, 166 this.classBuilder,
157 this.isInstanceMember, 167 this.isInstanceMember,
158 this.uri, 168 this.uri,
159 this._typeInferrer) 169 this._typeInferrer)
160 : enclosingScope = scope, 170 : enclosingScope = scope,
161 library = library, 171 library = library,
162 enableNative = library.loader.target.enableNative(library), 172 enableNative = library.loader.target.enableNative(library),
163 isBuiltinLibrary = 173 ignoreMainInGetMainClosure = library.uri.scheme == 'dart' &&
164 library.uri.scheme == 'dart' && library.uri.path == "_builtin", 174 (library.uri.path == "_builtin" || library.uri.path == "ui"),
165 needsImplicitSuperInitializer = 175 needsImplicitSuperInitializer =
166 coreTypes.objectClass != classBuilder?.cls, 176 coreTypes.objectClass != classBuilder?.cls,
167 typePromoter = _typeInferrer.typePromoter, 177 typePromoter = _typeInferrer.typePromoter,
168 super(scope); 178 super(scope);
169 179
170 bool get hasParserError => recoverableErrors.isNotEmpty; 180 bool get hasParserError => recoverableErrors.isNotEmpty;
171 181
172 bool get inConstructor { 182 bool get inConstructor {
173 return functionNestingLevel == 0 && member is KernelConstructorBuilder; 183 return functionNestingLevel == 0 && member is KernelConstructorBuilder;
174 } 184 }
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 builder == null && 970 builder == null &&
961 "loadLibrary" == name) { 971 "loadLibrary" == name) {
962 return buildCompileTimeError( 972 return buildCompileTimeError(
963 "Deferred loading isn't implemented yet.", offsetForToken(token)); 973 "Deferred loading isn't implemented yet.", offsetForToken(token));
964 } else if (!isQualified && isInstanceContext) { 974 } else if (!isQualified && isInstanceContext) {
965 assert(builder == null); 975 assert(builder == null);
966 if (constantExpressionRequired) { 976 if (constantExpressionRequired) {
967 return new UnresolvedAccessor(this, n, token); 977 return new UnresolvedAccessor(this, n, token);
968 } 978 }
969 return new ThisPropertyAccessor(this, token, n, null, null); 979 return new ThisPropertyAccessor(this, token, n, null, null);
970 } else if (isBuiltinLibrary && 980 } else if (ignoreMainInGetMainClosure &&
971 name == "main" && 981 name == "main" &&
972 member?.name == "_getMainClosure") { 982 member?.name == "_getMainClosure") {
973 // TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
974 return new KernelNullLiteral()..fileOffset = offsetForToken(token); 983 return new KernelNullLiteral()..fileOffset = offsetForToken(token);
975 } else { 984 } else {
976 return new UnresolvedAccessor(this, n, token); 985 return new UnresolvedAccessor(this, n, token);
977 } 986 }
978 } else if (builder.isTypeDeclaration) { 987 } else if (builder.isTypeDeclaration) {
979 if (constantExpressionRequired && 988 if (constantExpressionRequired &&
980 builder.isTypeVariable && 989 builder.isTypeVariable &&
981 !member.isConstructor) { 990 !member.isConstructor) {
982 addCompileTimeError( 991 addCompileTimeError(
983 offsetForToken(token), "Not a constant expression."); 992 offsetForToken(token), "Not a constant expression.");
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after
3473 if (starToken == null) { 3482 if (starToken == null) {
3474 return AsyncMarker.Async; 3483 return AsyncMarker.Async;
3475 } else { 3484 } else {
3476 assert(identical(starToken.stringValue, "*")); 3485 assert(identical(starToken.stringValue, "*"));
3477 return AsyncMarker.AsyncStar; 3486 return AsyncMarker.AsyncStar;
3478 } 3487 }
3479 } else { 3488 } else {
3480 return internalError("Unknown async modifier: $asyncToken"); 3489 return internalError("Unknown async modifier: $asyncToken");
3481 } 3490 }
3482 } 3491 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698