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

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

Issue 2980823002: Remove deprecated_warning. (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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 908 }
909 909
910 @override 910 @override
911 Expression toSuperMethodInvocation(MethodInvocation node) { 911 Expression toSuperMethodInvocation(MethodInvocation node) {
912 Member target = lookupSuperMember(node.name); 912 Member target = lookupSuperMember(node.name);
913 if (target == null || (target is Procedure && !target.isAccessor)) { 913 if (target == null || (target is Procedure && !target.isAccessor)) {
914 if (target == null) { 914 if (target == null) {
915 warnUnresolvedSuperMethod(node.name, node.fileOffset); 915 warnUnresolvedSuperMethod(node.name, node.fileOffset);
916 } else if (!areArgumentsCompatible(target.function, node.arguments)) { 916 } else if (!areArgumentsCompatible(target.function, node.arguments)) {
917 target = null; 917 target = null;
918 deprecated_warning( 918 warning(
919 "Super class doesn't have a method named '${node.name.name}' " 919 fasta.templateSuperclassMethodArgumentMismatch
920 "with matching arguments.", 920 .withArguments(node.name.name),
921 node.fileOffset); 921 node.fileOffset);
922 } 922 }
923 Expression result; 923 Expression result;
924 if (target != null) { 924 if (target != null) {
925 result = new KernelDirectMethodInvocation( 925 result = new KernelDirectMethodInvocation(
926 new KernelThisExpression()..fileOffset = node.fileOffset, 926 new KernelThisExpression()..fileOffset = node.fileOffset,
927 target, 927 target,
928 node.arguments); 928 node.arguments);
929 } 929 }
930 // TODO(ahe): Use [DirectMethodInvocation] when possible, that is, 930 // TODO(ahe): Use [DirectMethodInvocation] when possible, that is,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 isSetter: isSetter, 980 isSetter: isSetter,
981 isStatic: isStatic, 981 isStatic: isStatic,
982 isTopLevel: !isStatic && !isSuper); 982 isTopLevel: !isStatic && !isSuper);
983 warning(message, charOffset); 983 warning(message, charOffset);
984 return new KernelSyntheticExpression(new Throw(error)); 984 return new KernelSyntheticExpression(new Throw(error));
985 } 985 }
986 } 986 }
987 987
988 @override 988 @override
989 void warnUnresolvedSuperGet(Name name, int charOffset) { 989 void warnUnresolvedSuperGet(Name name, int charOffset) {
990 deprecated_warning( 990 warning(fasta.templateSuperclassHasNoGetter.withArguments(name.name),
991 "Super class has no getter named '${name.name}'.", charOffset); 991 charOffset);
992 } 992 }
993 993
994 @override 994 @override
995 void warnUnresolvedSuperSet(Name name, int charOffset) { 995 void warnUnresolvedSuperSet(Name name, int charOffset) {
996 deprecated_warning( 996 warning(fasta.templateSuperclassHasNoSetter.withArguments(name.name),
997 "Super class has no setter named '${name.name}'.", charOffset); 997 charOffset);
998 } 998 }
999 999
1000 @override 1000 @override
1001 void warnUnresolvedSuperMethod(Name name, int charOffset) { 1001 void warnUnresolvedSuperMethod(Name name, int charOffset) {
1002 deprecated_warning( 1002 warning(fasta.templateSuperclassHasNoMethod.withArguments(name.name),
1003 "Super class has no method named '${name.name}'.", charOffset); 1003 charOffset);
1004 } 1004 }
1005 1005
1006 @override 1006 @override
1007 Member lookupSuperMember(Name name, {bool isSetter: false}) { 1007 Member lookupSuperMember(Name name, {bool isSetter: false}) {
1008 Class superclass = classBuilder.cls.superclass; 1008 Class superclass = classBuilder.cls.superclass;
1009 return superclass == null 1009 return superclass == null
1010 ? null 1010 ? null
1011 : hierarchy.getDispatchTarget(superclass, name, setter: isSetter); 1011 : hierarchy.getDispatchTarget(superclass, name, setter: isSetter);
1012 } 1012 }
1013 1013
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 } 1628 }
1629 } 1629 }
1630 push( 1630 push(
1631 new KernelSymbolLiteral(value)..fileOffset = offsetForToken(hashToken)); 1631 new KernelSymbolLiteral(value)..fileOffset = offsetForToken(hashToken));
1632 } 1632 }
1633 1633
1634 DartType kernelTypeFromString( 1634 DartType kernelTypeFromString(
1635 String name, List<DartType> arguments, int charOffset) { 1635 String name, List<DartType> arguments, int charOffset) {
1636 Builder builder = scope.lookup(name, charOffset, uri); 1636 Builder builder = scope.lookup(name, charOffset, uri);
1637 if (builder == null) { 1637 if (builder == null) {
1638 deprecated_warning("Type not found: '$name'.", charOffset); 1638 warning(fasta.templateTypeNotFound.withArguments(name), charOffset);
1639 return const InvalidType(); 1639 return const InvalidType();
1640 } else { 1640 } else {
1641 return kernelTypeFromBuilder(builder, arguments, charOffset); 1641 return kernelTypeFromBuilder(builder, arguments, charOffset);
1642 } 1642 }
1643 } 1643 }
1644 1644
1645 DartType kernelTypeFromBuilder( 1645 DartType kernelTypeFromBuilder(
1646 Builder builder, List<DartType> arguments, int charOffset) { 1646 Builder builder, List<DartType> arguments, int charOffset) {
1647 if (constantExpressionRequired && builder is TypeVariableBuilder) { 1647 if (constantExpressionRequired && builder is TypeVariableBuilder) {
1648 deprecated_addCompileTimeError(charOffset, "Not a constant expression."); 1648 deprecated_addCompileTimeError(charOffset, "Not a constant expression.");
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 if (member.isNative) { 3267 if (member.isNative) {
3268 push(NullValue.FunctionBody); 3268 push(NullValue.FunctionBody);
3269 } else { 3269 } else {
3270 push(new Block(<Statement>[ 3270 push(new Block(<Statement>[
3271 deprecated_buildCompileTimeErrorStatement( 3271 deprecated_buildCompileTimeErrorStatement(
3272 "Expected '{'.", token.charOffset) 3272 "Expected '{'.", token.charOffset)
3273 ])); 3273 ]));
3274 } 3274 }
3275 } 3275 }
3276 3276
3277 @override
3278 void deprecated_warning(String message, [int charOffset = -1]) {
3279 if (constantExpressionRequired) {
3280 deprecated_addCompileTimeError(charOffset, message);
3281 } else {
3282 super.deprecated_warning(message, charOffset);
3283 }
3284 }
3285
3286 void warningNotError(Message message, int charOffset) { 3277 void warningNotError(Message message, int charOffset) {
3287 super.warning(message, charOffset); 3278 super.warning(message, charOffset);
3288 } 3279 }
3289 3280
3290 @override 3281 @override
3291 DartType validatedTypeVariableUse( 3282 DartType validatedTypeVariableUse(
3292 TypeParameterType type, int offset, bool nonInstanceAccessIsError) { 3283 TypeParameterType type, int offset, bool nonInstanceAccessIsError) {
3293 if (!isInstanceContext && type.parameter.parent is Class) { 3284 if (!isInstanceContext && type.parameter.parent is Class) {
3294 String message = "Type variables can't be used in static members."; 3285 Message message = fasta.messageTypeVariableInStaticContext;
3295 if (nonInstanceAccessIsError) { 3286 if (nonInstanceAccessIsError) {
3296 deprecated_addCompileTimeError(offset, message); 3287 addCompileTimeError(message, offset);
3297 } else { 3288 } else {
3298 deprecated_warning(message, offset); 3289 warning(message, offset);
3299 } 3290 }
3300 return const InvalidType(); 3291 return const InvalidType();
3301 } else if (constantExpressionRequired) { 3292 } else if (constantExpressionRequired) {
3302 deprecated_addCompileTimeError( 3293 deprecated_addCompileTimeError(
3303 offset, 3294 offset,
3304 "Type variable '${type.parameter.name}' can't be used as a constant " 3295 "Type variable '${type.parameter.name}' can't be used as a constant "
3305 "expression $type."); 3296 "expression $type.");
3306 } 3297 }
3307 return type; 3298 return type;
3308 } 3299 }
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
3826 return AsyncMarker.Async; 3817 return AsyncMarker.Async;
3827 } else { 3818 } else {
3828 assert(identical(starToken.stringValue, "*")); 3819 assert(identical(starToken.stringValue, "*"));
3829 return AsyncMarker.AsyncStar; 3820 return AsyncMarker.AsyncStar;
3830 } 3821 }
3831 } else { 3822 } else {
3832 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens", 3823 return unhandled(asyncToken.lexeme, "asyncMarkerFromTokens",
3833 asyncToken.charOffset, null); 3824 asyncToken.charOffset, null);
3834 } 3825 }
3835 } 3826 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698