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

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

Issue 2977903002: Remove deprecated_warningNotError. (Closed)
Patch Set: Created 3 years, 5 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 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 hide InvalidExpression, InvalidInitializer, InvalidStatement; 8 hide InvalidExpression, InvalidInitializer, InvalidStatement;
9 9
10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; 10 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 push(statement); 3005 push(statement);
3006 } 3006 }
3007 } 3007 }
3008 3008
3009 @override 3009 @override
3010 void endTypeVariable(Token token, Token extendsOrSuper) { 3010 void endTypeVariable(Token token, Token extendsOrSuper) {
3011 debugEvent("TypeVariable"); 3011 debugEvent("TypeVariable");
3012 DartType bound = pop(); 3012 DartType bound = pop();
3013 if (bound != null) { 3013 if (bound != null) {
3014 // TODO(ahe): To handle F-bounded types, this needs to be a TypeBuilder. 3014 // TODO(ahe): To handle F-bounded types, this needs to be a TypeBuilder.
3015 deprecated_warningNotError("Type variable bounds not implemented yet.", 3015 warningNotError(
3016 fasta.templateUnspecified
3017 .withArguments("Type variable bounds not implemented yet."),
Johnni Winther 2017/07/13 09:11:51 Any reason for not making this a template?
ahe 2017/07/13 11:14:19 I've used the same template as `unimplemented`.
3016 offsetForToken(extendsOrSuper.next)); 3018 offsetForToken(extendsOrSuper.next));
3017 } 3019 }
3018 Identifier name = pop(); 3020 Identifier name = pop();
3019 // TODO(ahe): Do not discard metadata. 3021 // TODO(ahe): Do not discard metadata.
3020 pop(); // Metadata. 3022 pop(); // Metadata.
3021 push(new KernelTypeVariableBuilder( 3023 push(new KernelTypeVariableBuilder(
3022 name.name, library, offsetForToken(name.token), null) 3024 name.name, library, offsetForToken(name.token), null)
3023 ..finish(library, library.loader.coreLibrary["Object"])); 3025 ..finish(library, library.loader.coreLibrary["Object"]));
3024 } 3026 }
3025 3027
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 Expression deprecated_wrapInCompileTimeError( 3115 Expression deprecated_wrapInCompileTimeError(
3114 Expression expression, String message) { 3116 Expression expression, String message) {
3115 return new Let( 3117 return new Let(
3116 new VariableDeclaration.forValue(expression) 3118 new VariableDeclaration.forValue(expression)
3117 ..fileOffset = expression.fileOffset, 3119 ..fileOffset = expression.fileOffset,
3118 deprecated_buildCompileTimeError(message, expression.fileOffset)) 3120 deprecated_buildCompileTimeError(message, expression.fileOffset))
3119 ..fileOffset = expression.fileOffset; 3121 ..fileOffset = expression.fileOffset;
3120 } 3122 }
3121 3123
3122 Expression buildFallThroughError(int charOffset) { 3124 Expression buildFallThroughError(int charOffset) {
3123 deprecated_warningNotError( 3125 warningNotError(fasta.messageSwitchCaseFallThrough, charOffset);
3124 "Switch case may fall through to next case.", charOffset);
3125 3126
3126 Location location = messages.getLocationFromUri(uri, charOffset); 3127 Location location = messages.getLocationFromUri(uri, charOffset);
3127 3128
3128 return new Throw(buildStaticInvocation( 3129 return new Throw(buildStaticInvocation(
3129 library.loader.coreTypes.fallThroughErrorUrlAndLineConstructor, 3130 library.loader.coreTypes.fallThroughErrorUrlAndLineConstructor,
3130 new Arguments(<Expression>[ 3131 new Arguments(<Expression>[
3131 new StringLiteral(location?.file ?? uri.toString()), 3132 new StringLiteral(location?.file ?? uri.toString()),
3132 new IntLiteral(location?.line ?? 0) 3133 new IntLiteral(location?.line ?? 0)
3133 ]), 3134 ]),
3134 charOffset: charOffset)); 3135 charOffset: charOffset));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 if (builder is KernelFieldBuilder && builder.isInstanceMember) { 3176 if (builder is KernelFieldBuilder && builder.isInstanceMember) {
3176 initializedFields ??= <String, int>{}; 3177 initializedFields ??= <String, int>{};
3177 if (initializedFields.containsKey(name)) { 3178 if (initializedFields.containsKey(name)) {
3178 return buildDuplicatedInitializer( 3179 return buildDuplicatedInitializer(
3179 name, offset, initializedFields[name]); 3180 name, offset, initializedFields[name]);
3180 } 3181 }
3181 initializedFields[name] = offset; 3182 initializedFields[name] = offset;
3182 if (builder.isFinal && builder.hasInitializer) { 3183 if (builder.isFinal && builder.hasInitializer) {
3183 // TODO(ahe): If CL 2843733002 is landed, this becomes a compile-time 3184 // TODO(ahe): If CL 2843733002 is landed, this becomes a compile-time
3184 // error. Also, this is a compile-time error in strong mode. 3185 // error. Also, this is a compile-time error in strong mode.
3185 deprecated_warningNotError( 3186 warningNotError(
3186 "'$name' is final instance variable that has already been " 3187 fasta.templateFinalInstanceVariableAlreadyInitialized
3187 "initialized.", 3188 .withArguments(name),
3188 offset); 3189 offset);
3189 deprecated_warningNotError( 3190 warningNotError(
3190 "'$name' was initialized here.", builder.charOffset); 3191 fasta.templateFinalInstanceVariableAlreadyInitializedCause
3192 .withArguments(name),
3193 builder.charOffset);
3191 Builder constructor = 3194 Builder constructor =
3192 library.loader.getDuplicatedFieldInitializerError(); 3195 library.loader.getDuplicatedFieldInitializerError();
3193 return buildInvalidInitializer( 3196 return buildInvalidInitializer(
3194 new Throw(buildStaticInvocation(constructor.target, 3197 new Throw(buildStaticInvocation(constructor.target,
3195 new Arguments(<Expression>[new StringLiteral(name)]), 3198 new Arguments(<Expression>[new StringLiteral(name)]),
3196 charOffset: offset)), 3199 charOffset: offset)),
3197 offset); 3200 offset);
3198 } else { 3201 } else {
3199 return new FieldInitializer(builder.field, expression) 3202 return new FieldInitializer(builder.field, expression)
3200 ..fileOffset = offset; 3203 ..fileOffset = offset;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 3276
3274 @override 3277 @override
3275 void deprecated_warning(String message, [int charOffset = -1]) { 3278 void deprecated_warning(String message, [int charOffset = -1]) {
3276 if (constantExpressionRequired) { 3279 if (constantExpressionRequired) {
3277 deprecated_addCompileTimeError(charOffset, message); 3280 deprecated_addCompileTimeError(charOffset, message);
3278 } else { 3281 } else {
3279 super.deprecated_warning(message, charOffset); 3282 super.deprecated_warning(message, charOffset);
3280 } 3283 }
3281 } 3284 }
3282 3285
3283 void deprecated_warningNotError(String message, [int charOffset = -1]) {
3284 super.deprecated_warning(message, charOffset);
3285 }
3286
3287 void warningNotError(Message message, int charOffset) { 3286 void warningNotError(Message message, int charOffset) {
3288 super.warning(message, charOffset); 3287 super.warning(message, charOffset);
3289 } 3288 }
3290 3289
3291 @override 3290 @override
3292 DartType validatedTypeVariableUse( 3291 DartType validatedTypeVariableUse(
3293 TypeParameterType type, int offset, bool nonInstanceAccessIsError) { 3292 TypeParameterType type, int offset, bool nonInstanceAccessIsError) {
3294 if (!isInstanceContext && type.parameter.parent is Class) { 3293 if (!isInstanceContext && type.parameter.parent is Class) {
3295 String message = "Type variables can't be used in static members."; 3294 String message = "Type variables can't be used in static members.";
3296 if (nonInstanceAccessIsError) { 3295 if (nonInstanceAccessIsError) {
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
3827 return AsyncMarker.Async; 3826 return AsyncMarker.Async;
3828 } else { 3827 } else {
3829 assert(identical(starToken.stringValue, "*")); 3828 assert(identical(starToken.stringValue, "*"));
3830 return AsyncMarker.AsyncStar; 3829 return AsyncMarker.AsyncStar;
3831 } 3830 }
3832 } else { 3831 } else {
3833 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", 3832 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens",
3834 asyncToken.charOffset, null); 3833 asyncToken.charOffset, null);
3835 } 3834 }
3836 } 3835 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698