| Index: pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| index 8659dfea7e32437c0077b9f9a655d5275c05b427..4ac8ead1a536c984ded5f22d7a35232c48cfbda5 100644
|
| --- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| +++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| @@ -8,6 +8,7 @@ import 'dart:collection';
|
|
|
| import 'package:analyzer/context/declared_variables.dart';
|
| import 'package:analyzer/dart/ast/ast.dart';
|
| +import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
| import 'package:analyzer/dart/ast/token.dart';
|
| import 'package:analyzer/dart/ast/visitor.dart';
|
| import 'package:analyzer/dart/constant/value.dart';
|
| @@ -29,7 +30,6 @@ import 'package:analyzer/src/generated/type_system.dart'
|
| import 'package:analyzer/src/generated/utilities_collection.dart';
|
| import 'package:analyzer/src/generated/utilities_dart.dart' show ParameterKind;
|
| import 'package:analyzer/src/task/dart.dart';
|
| -import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
|
|
| /**
|
| * Helper class encapsulating the methods for evaluating constants and
|
| @@ -1294,7 +1294,7 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| ParameterizedType elseType = elseResult.type;
|
| return new DartObjectImpl.validWithUnknownValue(
|
| _typeSystem.getLeastUpperBound(_typeProvider, thenType, elseType)
|
| - as InterfaceType);
|
| + as InterfaceType);
|
| }
|
|
|
| @override
|
| @@ -1359,9 +1359,9 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| return null;
|
| }
|
| DartType elementType = _typeProvider.dynamicType;
|
| - NodeList<TypeName> typeArgs = node.typeArguments?.arguments;
|
| + NodeList<TypeAnnotation> typeArgs = node.typeArguments?.arguments;
|
| if (typeArgs?.length == 1) {
|
| - DartType type = visitTypeName(typeArgs[0])?.toTypeValue();
|
| + DartType type = visitTypeAnnotation(typeArgs[0])?.toTypeValue();
|
| if (type != null) {
|
| elementType = type;
|
| }
|
| @@ -1394,13 +1394,15 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
| DartType keyType = _typeProvider.dynamicType;
|
| DartType valueType = _typeProvider.dynamicType;
|
| - NodeList<TypeName> typeArgs = node.typeArguments?.arguments;
|
| + NodeList<TypeAnnotation> typeArgs = node.typeArguments?.arguments;
|
| if (typeArgs?.length == 2) {
|
| - DartType keyTypeCandidate = visitTypeName(typeArgs[0])?.toTypeValue();
|
| + DartType keyTypeCandidate =
|
| + visitTypeAnnotation(typeArgs[0])?.toTypeValue();
|
| if (keyTypeCandidate != null) {
|
| keyType = keyTypeCandidate;
|
| }
|
| - DartType valueTypeCandidate = visitTypeName(typeArgs[1])?.toTypeValue();
|
| + DartType valueTypeCandidate =
|
| + visitTypeAnnotation(typeArgs[1])?.toTypeValue();
|
| if (valueTypeCandidate != null) {
|
| valueType = valueTypeCandidate;
|
| }
|
| @@ -1550,8 +1552,7 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| _typeProvider.symbolType, new SymbolState(buffer.toString()));
|
| }
|
|
|
| - @override
|
| - DartObjectImpl visitTypeName(TypeName node) {
|
| + DartObjectImpl visitTypeAnnotation(TypeAnnotation node) {
|
| DartType type = evaluateType(node.type);
|
| if (type == null) {
|
| return super.visitTypeName(node);
|
| @@ -1559,6 +1560,9 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| return typeConstant(type);
|
| }
|
|
|
| + @override
|
| + DartObjectImpl visitTypeName(TypeName node) => visitTypeAnnotation(node);
|
| +
|
| /**
|
| * Create an error associated with the given [node]. The error will have the
|
| * given error [code].
|
|
|