|
2 | 2 | // for details. All rights reserved. Use of this source code is governed by a
|
3 | 3 | // BSD-style license that can be found in the LICENSE file.
|
4 | 4 |
|
5 |
| -import 'package:analyzer/dart/analysis/session.dart'; |
6 |
| - |
7 | 5 | /// This library is capable of producing linked summaries from unlinked
|
8 | 6 | /// ones (or prelinked ones). It functions by building a miniature
|
9 | 7 | /// element model to represent the contents of the summaries, and then
|
@@ -57,6 +55,7 @@ import 'package:analyzer/dart/analysis/session.dart';
|
57 | 55 | ///
|
58 | 56 | /// - Where possible, we favor method dispatch instead of "is" and "as"
|
59 | 57 | /// checks. E.g. see [ReferenceableElementForLink.asConstructor].
|
| 58 | +import 'package:analyzer/dart/analysis/session.dart'; |
60 | 59 | import 'package:analyzer/dart/ast/ast.dart';
|
61 | 60 | import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
62 | 61 | import 'package:analyzer/dart/element/element.dart';
|
@@ -413,6 +412,11 @@ typedef LinkedLibrary GetDependencyCallback(String absoluteUri);
|
413 | 412 | /// [UnlinkedUnit] objects.
|
414 | 413 | typedef UnlinkedUnit GetUnitCallback(String absoluteUri);
|
415 | 414 |
|
| 415 | +class AnalysisSessionForLink implements AnalysisSession { |
| 416 | + @override |
| 417 | + noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 418 | +} |
| 419 | + |
416 | 420 | /// Element representing a class or enum resynthesized from a summary
|
417 | 421 | /// during linking.
|
418 | 422 | abstract class ClassElementForLink
|
@@ -3638,6 +3642,9 @@ abstract class LibraryElementForLink<
|
3638 | 3642 | @override
|
3639 | 3643 | LibraryResynthesizerContext get resynthesizerContext => this;
|
3640 | 3644 |
|
| 3645 | + @override |
| 3646 | + AnalysisSession get session => _linker.session; |
| 3647 | + |
3641 | 3648 | @override
|
3642 | 3649 | Source get source => definingCompilationUnit.source;
|
3643 | 3650 |
|
@@ -3936,6 +3943,7 @@ class Linker {
|
3936 | 3943 | SpecialTypeElementForLink _bottomElement;
|
3937 | 3944 | InheritanceManager2 _inheritanceManager;
|
3938 | 3945 | ContextForLink _context;
|
| 3946 | + AnalysisSessionForLink _session; |
3939 | 3947 |
|
3940 | 3948 | /// Gets an instance of [AnalysisOptions] for use during linking.
|
3941 | 3949 | final AnalysisOptions analysisOptions;
|
@@ -3976,6 +3984,10 @@ class Linker {
|
3976 | 3984 | InheritanceManager2 get inheritanceManager =>
|
3977 | 3985 | _inheritanceManager ??= new InheritanceManager2(typeSystem);
|
3978 | 3986 |
|
| 3987 | + /// Get a stub implementation of [AnalysisContext] which can be used during |
| 3988 | + /// linking. |
| 3989 | + get session => _session ??= new AnalysisSessionForLink(); |
| 3990 | + |
3979 | 3991 | /// Indicates whether type inference should use strong mode rules.
|
3980 | 3992 | @deprecated
|
3981 | 3993 | bool get strongMode => true;
|
|
0 commit comments