| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.error_verifier; | 5 library analyzer.src.generated.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 ConstructorName constructorName = node.constructorName; | 861 ConstructorName constructorName = node.constructorName; |
| 862 TypeName typeName = constructorName.type; | 862 TypeName typeName = constructorName.type; |
| 863 DartType type = typeName.type; | 863 DartType type = typeName.type; |
| 864 if (type is InterfaceType) { | 864 if (type is InterfaceType) { |
| 865 _checkForConstOrNewWithAbstractClass(node, typeName, type); | 865 _checkForConstOrNewWithAbstractClass(node, typeName, type); |
| 866 _checkForConstOrNewWithEnum(node, typeName, type); | 866 _checkForConstOrNewWithEnum(node, typeName, type); |
| 867 if (_isInConstInstanceCreation) { | 867 if (_isInConstInstanceCreation) { |
| 868 _checkForConstWithNonConst(node); | 868 _checkForConstWithNonConst(node); |
| 869 _checkForConstWithUndefinedConstructor( | 869 _checkForConstWithUndefinedConstructor( |
| 870 node, constructorName, typeName); | 870 node, constructorName, typeName); |
| 871 _checkForConstWithTypeParameters(typeName); | 871 if (!_options.strongMode) { |
| 872 _checkForConstWithTypeParameters(typeName); |
| 873 } |
| 872 _checkForConstDeferredClass(node, constructorName, typeName); | 874 _checkForConstDeferredClass(node, constructorName, typeName); |
| 873 } else { | 875 } else { |
| 874 _checkForNewWithUndefinedConstructor(node, constructorName, typeName); | 876 _checkForNewWithUndefinedConstructor(node, constructorName, typeName); |
| 875 } | 877 } |
| 876 } | 878 } |
| 877 _checkForImplicitDynamicType(typeName); | 879 _checkForImplicitDynamicType(typeName); |
| 878 return super.visitInstanceCreationExpression(node); | 880 return super.visitInstanceCreationExpression(node); |
| 879 } finally { | 881 } finally { |
| 880 _isInConstInstanceCreation = wasInConstInstanceCreation; | 882 _isInConstInstanceCreation = wasInConstInstanceCreation; |
| 881 } | 883 } |
| 882 } | 884 } |
| 883 | 885 |
| 884 @override | 886 @override |
| 885 Object visitIsExpression(IsExpression node) { | 887 Object visitIsExpression(IsExpression node) { |
| 886 _checkForTypeAnnotationDeferredClass(node.type); | 888 _checkForTypeAnnotationDeferredClass(node.type); |
| 887 return super.visitIsExpression(node); | 889 return super.visitIsExpression(node); |
| 888 } | 890 } |
| 889 | 891 |
| 890 @override | 892 @override |
| 891 Object visitListLiteral(ListLiteral node) { | 893 Object visitListLiteral(ListLiteral node) { |
| 892 TypeArgumentList typeArguments = node.typeArguments; | 894 TypeArgumentList typeArguments = node.typeArguments; |
| 893 if (typeArguments != null) { | 895 if (typeArguments != null) { |
| 894 if (node.constKeyword != null) { | 896 if (!_options.strongMode && node.constKeyword != null) { |
| 895 NodeList<TypeName> arguments = typeArguments.arguments; | 897 NodeList<TypeName> arguments = typeArguments.arguments; |
| 896 if (arguments.length != 0) { | 898 if (arguments.isNotEmpty) { |
| 897 _checkForInvalidTypeArgumentInConstTypedLiteral(arguments, | 899 _checkForInvalidTypeArgumentInConstTypedLiteral(arguments, |
| 898 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST); | 900 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST); |
| 899 } | 901 } |
| 900 } | 902 } |
| 901 _checkForExpectedOneListTypeArgument(node, typeArguments); | 903 _checkForExpectedOneListTypeArgument(node, typeArguments); |
| 902 } | 904 } |
| 903 _checkForImplicitDynamicTypedLiteral(node); | 905 _checkForImplicitDynamicTypedLiteral(node); |
| 904 _checkForListElementTypeNotAssignable(node); | 906 _checkForListElementTypeNotAssignable(node); |
| 905 return super.visitListLiteral(node); | 907 return super.visitListLiteral(node); |
| 906 } | 908 } |
| 907 | 909 |
| 908 @override | 910 @override |
| 909 Object visitMapLiteral(MapLiteral node) { | 911 Object visitMapLiteral(MapLiteral node) { |
| 910 TypeArgumentList typeArguments = node.typeArguments; | 912 TypeArgumentList typeArguments = node.typeArguments; |
| 911 if (typeArguments != null) { | 913 if (typeArguments != null) { |
| 912 NodeList<TypeName> arguments = typeArguments.arguments; | 914 NodeList<TypeName> arguments = typeArguments.arguments; |
| 913 if (arguments.length != 0) { | 915 if (!_options.strongMode && arguments.isNotEmpty) { |
| 914 if (node.constKeyword != null) { | 916 if (node.constKeyword != null) { |
| 915 _checkForInvalidTypeArgumentInConstTypedLiteral(arguments, | 917 _checkForInvalidTypeArgumentInConstTypedLiteral(arguments, |
| 916 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP); | 918 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP); |
| 917 } | 919 } |
| 918 } | 920 } |
| 919 _checkExpectedTwoMapTypeArguments(typeArguments); | 921 _checkExpectedTwoMapTypeArguments(typeArguments); |
| 920 } | 922 } |
| 921 _checkForImplicitDynamicTypedLiteral(node); | 923 _checkForImplicitDynamicTypedLiteral(node); |
| 922 _checkForMapTypeNotAssignable(node); | 924 _checkForMapTypeNotAssignable(node); |
| 923 _checkForNonConstMapAsExpressionStatement(node); | 925 _checkForNonConstMapAsExpressionStatement(node); |
| (...skipping 5531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6455 class _InvocationCollector extends RecursiveAstVisitor { | 6457 class _InvocationCollector extends RecursiveAstVisitor { |
| 6456 final List<String> superCalls = <String>[]; | 6458 final List<String> superCalls = <String>[]; |
| 6457 | 6459 |
| 6458 @override | 6460 @override |
| 6459 visitMethodInvocation(MethodInvocation node) { | 6461 visitMethodInvocation(MethodInvocation node) { |
| 6460 if (node.target is SuperExpression) { | 6462 if (node.target is SuperExpression) { |
| 6461 superCalls.add(node.methodName.name); | 6463 superCalls.add(node.methodName.name); |
| 6462 } | 6464 } |
| 6463 } | 6465 } |
| 6464 } | 6466 } |
| OLD | NEW |