| 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/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 import 'package:analyzer/src/generated/scanner.dart'; | 25 import 'package:analyzer/src/generated/scanner.dart'; |
| 26 import 'package:analyzer/src/generated/sdk.dart'; | 26 import 'package:analyzer/src/generated/sdk.dart'; |
| 27 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 27 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
| 28 import 'package:analyzer/src/generated/source_io.dart'; | 28 import 'package:analyzer/src/generated/source_io.dart'; |
| 29 import 'package:analyzer/src/generated/static_type_analyzer.dart'; | 29 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| 30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 31 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 31 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 32 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 32 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 33 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 33 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 34 import 'package:analyzer/src/generated/utilities_dart.dart'; | 34 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 35 import 'package:analyzer/src/task/dart.dart'; |
| 35 import 'package:unittest/unittest.dart'; | 36 import 'package:unittest/unittest.dart'; |
| 36 | 37 |
| 37 import '../reflective_tests.dart'; | 38 import '../reflective_tests.dart'; |
| 38 import '../utils.dart'; | 39 import '../utils.dart'; |
| 39 import 'test_support.dart'; | 40 import 'test_support.dart'; |
| 40 | 41 |
| 41 main() { | 42 main() { |
| 42 initializeTestEnvironment(); | 43 initializeTestEnvironment(); |
| 43 runReflectiveTests(AnalysisDeltaTest); | 44 runReflectiveTests(AnalysisDeltaTest); |
| 44 runReflectiveTests(ChangeSetTest); | 45 runReflectiveTests(ChangeSetTest); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 coreContext.setContents(source, ""); | 391 coreContext.setContents(source, ""); |
| 391 // | 392 // |
| 392 // Record the elements. | 393 // Record the elements. |
| 393 // | 394 // |
| 394 HashMap<Source, LibraryElement> elementMap = | 395 HashMap<Source, LibraryElement> elementMap = |
| 395 new HashMap<Source, LibraryElement>(); | 396 new HashMap<Source, LibraryElement>(); |
| 396 elementMap[coreSource] = coreLibrary; | 397 elementMap[coreSource] = coreLibrary; |
| 397 elementMap[asyncSource] = asyncLibrary; | 398 elementMap[asyncSource] = asyncLibrary; |
| 398 elementMap[htmlSource] = htmlLibrary; | 399 elementMap[htmlSource] = htmlLibrary; |
| 399 elementMap[mathSource] = mathLibrary; | 400 elementMap[mathSource] = mathLibrary; |
| 401 // |
| 402 // Set the public and export namespaces. We don't use exports in the fake |
| 403 // core library so public and export namespaces are the same. |
| 404 // |
| 405 for (LibraryElementImpl library in elementMap.values) { |
| 406 library.exportNamespace = |
| 407 library.publicNamespace = new PublicNamespaceBuilder().build(library); |
| 408 } |
| 400 context.recordLibraryElements(elementMap); | 409 context.recordLibraryElements(elementMap); |
| 401 return context; | 410 return context; |
| 402 } | 411 } |
| 403 } | 412 } |
| 404 | 413 |
| 405 /** | 414 /** |
| 406 * An analysis context that has a fake SDK that is much smaller and faster for | 415 * An analysis context that has a fake SDK that is much smaller and faster for |
| 407 * testing purposes. | 416 * testing purposes. |
| 408 */ | 417 */ |
| 409 class AnalysisContextForTests extends AnalysisContextImpl { | 418 class AnalysisContextForTests extends AnalysisContextImpl { |
| (...skipping 16188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16598 | 16607 |
| 16599 void _resolveTestUnit(String code) { | 16608 void _resolveTestUnit(String code) { |
| 16600 testCode = code; | 16609 testCode = code; |
| 16601 testSource = addSource(testCode); | 16610 testSource = addSource(testCode); |
| 16602 LibraryElement library = resolve2(testSource); | 16611 LibraryElement library = resolve2(testSource); |
| 16603 assertNoErrors(testSource); | 16612 assertNoErrors(testSource); |
| 16604 verify([testSource]); | 16613 verify([testSource]); |
| 16605 testUnit = resolveCompilationUnit(testSource, library); | 16614 testUnit = resolveCompilationUnit(testSource, library); |
| 16606 } | 16615 } |
| 16607 } | 16616 } |
| OLD | NEW |