| 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/token.dart'; |
| 11 import 'package:analyzer/dart/ast/visitor.dart'; | 11 import 'package:analyzer/dart/ast/visitor.dart'; |
| 12 import 'package:analyzer/dart/element/element.dart'; | 12 import 'package:analyzer/dart/element/element.dart'; |
| 13 import 'package:analyzer/dart/element/type.dart'; | 13 import 'package:analyzer/dart/element/type.dart'; |
| 14 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 14 import 'package:analyzer/src/context/context.dart'; | 15 import 'package:analyzer/src/context/context.dart'; |
| 15 import 'package:analyzer/src/dart/element/element.dart'; | 16 import 'package:analyzer/src/dart/element/element.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/engine.dart'; | 18 import 'package:analyzer/src/generated/engine.dart'; |
| 18 import 'package:analyzer/src/generated/error.dart'; | 19 import 'package:analyzer/src/generated/error.dart'; |
| 19 import 'package:analyzer/src/generated/java_core.dart'; | 20 import 'package:analyzer/src/generated/java_core.dart'; |
| 20 import 'package:analyzer/src/generated/java_engine_io.dart'; | 21 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 21 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 22 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 22 import 'package:analyzer/src/generated/resolver.dart'; | 23 import 'package:analyzer/src/generated/resolver.dart'; |
| 23 import 'package:analyzer/src/generated/source_io.dart'; | 24 import 'package:analyzer/src/generated/source_io.dart'; |
| 24 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 25 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 25 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 26 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 26 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 27 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 27 import 'package:analyzer/src/generated/utilities_dart.dart'; | 28 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 29 import 'package:analyzer/src/source/source_resource.dart'; |
| 28 import 'package:unittest/unittest.dart'; | 30 import 'package:unittest/unittest.dart'; |
| 29 | 31 |
| 30 import '../reflective_tests.dart'; | 32 import '../reflective_tests.dart'; |
| 31 import '../utils.dart'; | 33 import '../utils.dart'; |
| 32 import 'analysis_context_factory.dart'; | 34 import 'analysis_context_factory.dart'; |
| 33 import 'resolver_test_case.dart'; | 35 import 'resolver_test_case.dart'; |
| 34 import 'test_support.dart'; | 36 import 'test_support.dart'; |
| 35 | 37 |
| 36 main() { | 38 main() { |
| 37 initializeTestEnvironment(); | 39 initializeTestEnvironment(); |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 * The inheritance manager being tested. | 1030 * The inheritance manager being tested. |
| 1029 */ | 1031 */ |
| 1030 SubtypeManager _subtypeManager; | 1032 SubtypeManager _subtypeManager; |
| 1031 | 1033 |
| 1032 /** | 1034 /** |
| 1033 * The compilation unit element containing all of the types setup in each test
. | 1035 * The compilation unit element containing all of the types setup in each test
. |
| 1034 */ | 1036 */ |
| 1035 CompilationUnitElementImpl _definingCompilationUnit; | 1037 CompilationUnitElementImpl _definingCompilationUnit; |
| 1036 | 1038 |
| 1037 void setUp() { | 1039 void setUp() { |
| 1038 AnalysisContext context = AnalysisContextFactory.contextWithCore(); | 1040 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); |
| 1039 FileBasedSource source = | 1041 AnalysisContext context = AnalysisContextFactory.contextWithCore( |
| 1040 new FileBasedSource(FileUtilities2.createFile("/test.dart")); | 1042 resourceProvider: resourceProvider); |
| 1043 Source source = new FileSource(resourceProvider.getFile("/test.dart")); |
| 1041 _definingCompilationUnit = new CompilationUnitElementImpl("test.dart"); | 1044 _definingCompilationUnit = new CompilationUnitElementImpl("test.dart"); |
| 1042 _definingCompilationUnit.librarySource = | 1045 _definingCompilationUnit.librarySource = |
| 1043 _definingCompilationUnit.source = source; | 1046 _definingCompilationUnit.source = source; |
| 1044 LibraryElementImpl definingLibrary = | 1047 LibraryElementImpl definingLibrary = |
| 1045 ElementFactory.library(context, "test"); | 1048 ElementFactory.library(context, "test"); |
| 1046 definingLibrary.definingCompilationUnit = _definingCompilationUnit; | 1049 definingLibrary.definingCompilationUnit = _definingCompilationUnit; |
| 1047 _subtypeManager = new SubtypeManager(); | 1050 _subtypeManager = new SubtypeManager(); |
| 1048 } | 1051 } |
| 1049 | 1052 |
| 1050 void test_computeAllSubtypes_infiniteLoop() { | 1053 void test_computeAllSubtypes_infiniteLoop() { |
| (...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3015 ClassElement type = ElementFactory.classElement2("A"); | 3018 ClassElement type = ElementFactory.classElement2("A"); |
| 3016 VariableDeclaration node = AstFactory.variableDeclaration("a"); | 3019 VariableDeclaration node = AstFactory.variableDeclaration("a"); |
| 3017 AstFactory.variableDeclarationList(null, AstFactory.typeName(type), [node]); | 3020 AstFactory.variableDeclarationList(null, AstFactory.typeName(type), [node]); |
| 3018 //resolve(node); | 3021 //resolve(node); |
| 3019 expect(node.name.staticType, same(type.type)); | 3022 expect(node.name.staticType, same(type.type)); |
| 3020 _listener.assertNoErrors(); | 3023 _listener.assertNoErrors(); |
| 3021 } | 3024 } |
| 3022 | 3025 |
| 3023 void setUp() { | 3026 void setUp() { |
| 3024 _listener = new GatheringErrorListener(); | 3027 _listener = new GatheringErrorListener(); |
| 3025 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); | 3028 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); |
| 3029 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore( |
| 3030 resourceProvider: resourceProvider); |
| 3026 Source librarySource = | 3031 Source librarySource = |
| 3027 new FileBasedSource(FileUtilities2.createFile("/lib.dart")); | 3032 new FileSource(resourceProvider.getFile("/lib.dart")); |
| 3028 LibraryElementImpl element = new LibraryElementImpl.forNode( | 3033 LibraryElementImpl element = new LibraryElementImpl.forNode( |
| 3029 context, AstFactory.libraryIdentifier2(["lib"])); | 3034 context, AstFactory.libraryIdentifier2(["lib"])); |
| 3030 element.definingCompilationUnit = | 3035 element.definingCompilationUnit = |
| 3031 new CompilationUnitElementImpl("lib.dart"); | 3036 new CompilationUnitElementImpl("lib.dart"); |
| 3032 _typeProvider = new TestTypeProvider(); | 3037 _typeProvider = new TestTypeProvider(); |
| 3033 libraryScope = new LibraryScope(element, _listener); | 3038 libraryScope = new LibraryScope(element, _listener); |
| 3034 _visitor = new TypeResolverVisitor( | 3039 _visitor = new TypeResolverVisitor( |
| 3035 element, librarySource, _typeProvider, _listener, | 3040 element, librarySource, _typeProvider, _listener, |
| 3036 nameScope: libraryScope); | 3041 nameScope: libraryScope); |
| 3037 } | 3042 } |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3631 */ | 3636 */ |
| 3632 class _StaleElement extends ElementImpl { | 3637 class _StaleElement extends ElementImpl { |
| 3633 _StaleElement() : super("_StaleElement", -1); | 3638 _StaleElement() : super("_StaleElement", -1); |
| 3634 | 3639 |
| 3635 @override | 3640 @override |
| 3636 get kind => throw "_StaleElement's kind shouldn't be accessed"; | 3641 get kind => throw "_StaleElement's kind shouldn't be accessed"; |
| 3637 | 3642 |
| 3638 @override | 3643 @override |
| 3639 accept(_) => throw "_StaleElement shouldn't be visited"; | 3644 accept(_) => throw "_StaleElement shouldn't be visited"; |
| 3640 } | 3645 } |
| OLD | NEW |