| 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.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 11 import 'package:analyzer/dart/ast/visitor.dart'; |
| 11 import 'package:analyzer/dart/element/element.dart'; | 12 import 'package:analyzer/dart/element/element.dart'; |
| 12 import 'package:analyzer/dart/element/type.dart'; | 13 import 'package:analyzer/dart/element/type.dart'; |
| 13 import 'package:analyzer/src/context/context.dart'; | 14 import 'package:analyzer/src/context/context.dart'; |
| 14 import 'package:analyzer/src/dart/element/element.dart'; | 15 import 'package:analyzer/src/dart/element/element.dart'; |
| 15 import 'package:analyzer/src/dart/element/member.dart'; | 16 import 'package:analyzer/src/dart/element/member.dart'; |
| 16 import 'package:analyzer/src/dart/element/type.dart'; | 17 import 'package:analyzer/src/dart/element/type.dart'; |
| 17 import 'package:analyzer/src/generated/element_resolver.dart'; | 18 import 'package:analyzer/src/generated/element_resolver.dart'; |
| 18 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 19 import 'package:analyzer/src/generated/error.dart'; | 20 import 'package:analyzer/src/generated/error.dart'; |
| 20 import 'package:analyzer/src/generated/java_core.dart'; | 21 import 'package:analyzer/src/generated/java_core.dart'; |
| 21 import 'package:analyzer/src/generated/java_engine.dart'; | 22 import 'package:analyzer/src/generated/java_engine.dart'; |
| 22 import 'package:analyzer/src/generated/java_engine_io.dart'; | 23 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 23 import 'package:analyzer/src/generated/java_io.dart'; | 24 import 'package:analyzer/src/generated/java_io.dart'; |
| 24 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 25 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 25 import 'package:analyzer/src/generated/resolver.dart'; | 26 import 'package:analyzer/src/generated/resolver.dart'; |
| 26 import 'package:analyzer/dart/ast/token.dart'; | |
| 27 import 'package:analyzer/src/generated/sdk.dart'; | 27 import 'package:analyzer/src/generated/sdk.dart'; |
| 28 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 28 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
| 29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
| 30 import 'package:analyzer/src/generated/static_type_analyzer.dart'; | 30 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| 31 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 31 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 32 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 32 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 34 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 34 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 35 import 'package:analyzer/src/generated/utilities_dart.dart'; | 35 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 36 import 'package:analyzer/src/task/dart.dart'; | 36 import 'package:analyzer/src/task/dart.dart'; |
| (...skipping 7824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7861 return null; | 7861 return null; |
| 7862 } | 7862 } |
| 7863 return node.propertyName.accept(this); | 7863 return node.propertyName.accept(this); |
| 7864 } | 7864 } |
| 7865 | 7865 |
| 7866 @override | 7866 @override |
| 7867 Object visitSimpleIdentifier(SimpleIdentifier node) { | 7867 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 7868 if (node.name == "void") { | 7868 if (node.name == "void") { |
| 7869 return null; | 7869 return null; |
| 7870 } | 7870 } |
| 7871 if (node.staticType != null && |
| 7872 node.staticType.isDynamic && |
| 7873 node.staticElement == null) { |
| 7874 return null; |
| 7875 } |
| 7871 AstNode parent = node.parent; | 7876 AstNode parent = node.parent; |
| 7872 if (parent is MethodInvocation) { | 7877 if (parent is MethodInvocation) { |
| 7873 MethodInvocation invocation = parent; | 7878 MethodInvocation invocation = parent; |
| 7874 if (identical(invocation.methodName, node)) { | 7879 if (identical(invocation.methodName, node)) { |
| 7875 Expression target = invocation.realTarget; | 7880 Expression target = invocation.realTarget; |
| 7876 DartType targetType = target == null ? null : target.staticType; | 7881 DartType targetType = target == null ? null : target.staticType; |
| 7877 if (targetType == null || targetType.isDynamic) { | 7882 if (targetType == null || targetType.isDynamic) { |
| 7878 return null; | 7883 return null; |
| 7879 } | 7884 } |
| 7880 } | 7885 } |
| (...skipping 9237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17118 | 17123 |
| 17119 void _resolveTestUnit(String code) { | 17124 void _resolveTestUnit(String code) { |
| 17120 testCode = code; | 17125 testCode = code; |
| 17121 testSource = addSource(testCode); | 17126 testSource = addSource(testCode); |
| 17122 LibraryElement library = resolve2(testSource); | 17127 LibraryElement library = resolve2(testSource); |
| 17123 assertNoErrors(testSource); | 17128 assertNoErrors(testSource); |
| 17124 verify([testSource]); | 17129 verify([testSource]); |
| 17125 testUnit = resolveCompilationUnit(testSource, library); | 17130 testUnit = resolveCompilationUnit(testSource, library); |
| 17126 } | 17131 } |
| 17127 } | 17132 } |
| OLD | NEW |