Chromium Code Reviews| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 elementMap[mathSource] = mathLibrary; | 400 elementMap[mathSource] = mathLibrary; |
| 401 // | 401 // |
| 402 // Set the public and export namespaces. We don't use exports in the fake | 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. | 403 // core library so public and export namespaces are the same. |
| 404 // | 404 // |
| 405 for (LibraryElementImpl library in elementMap.values) { | 405 for (LibraryElementImpl library in elementMap.values) { |
| 406 library.exportNamespace = | 406 library.exportNamespace = |
| 407 library.publicNamespace = new PublicNamespaceBuilder().build(library); | 407 library.publicNamespace = new PublicNamespaceBuilder().build(library); |
| 408 } | 408 } |
| 409 context.recordLibraryElements(elementMap); | 409 context.recordLibraryElements(elementMap); |
| 410 // Create the synthetic element for `loadLibrary`. | |
| 411 coreLibrary.createLoadLibraryFunction(context.typeProvider); | |
|
Paul Berry
2016/01/13 16:53:38
Nit: why not just loop over the libraries in eleme
| |
| 412 asyncLibrary.createLoadLibraryFunction(context.typeProvider); | |
| 413 htmlLibrary.createLoadLibraryFunction(context.typeProvider); | |
| 414 mathLibrary.createLoadLibraryFunction(context.typeProvider); | |
| 410 return context; | 415 return context; |
| 411 } | 416 } |
| 412 } | 417 } |
| 413 | 418 |
| 414 /** | 419 /** |
| 415 * An analysis context that has a fake SDK that is much smaller and faster for | 420 * An analysis context that has a fake SDK that is much smaller and faster for |
| 416 * testing purposes. | 421 * testing purposes. |
| 417 */ | 422 */ |
| 418 class AnalysisContextForTests extends AnalysisContextImpl { | 423 class AnalysisContextForTests extends AnalysisContextImpl { |
| 419 @override | 424 @override |
| (...skipping 16266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16686 | 16691 |
| 16687 void _resolveTestUnit(String code) { | 16692 void _resolveTestUnit(String code) { |
| 16688 testCode = code; | 16693 testCode = code; |
| 16689 testSource = addSource(testCode); | 16694 testSource = addSource(testCode); |
| 16690 LibraryElement library = resolve2(testSource); | 16695 LibraryElement library = resolve2(testSource); |
| 16691 assertNoErrors(testSource); | 16696 assertNoErrors(testSource); |
| 16692 verify([testSource]); | 16697 verify([testSource]); |
| 16693 testUnit = resolveCompilationUnit(testSource, library); | 16698 testUnit = resolveCompilationUnit(testSource, library); |
| 16694 } | 16699 } |
| 16695 } | 16700 } |
| OLD | NEW |