mirror of
https://github.com/dart-lang/sdk
synced 2024-09-06 00:59:09 +00:00
Revert adding enclosingLibrary to ast.dart
Change-Id: Iacc24b512d1ff40bd54e37ba0ad0611fa46234b7 Reviewed-on: https://dart-review.googlesource.com/c/93169 Auto-Submit: Daco Harkes <dacoharkes@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
8333c8a4d0
commit
6a5c9597c6
|
@ -155,8 +155,6 @@ abstract class TreeNode extends Node {
|
|||
|
||||
Component get enclosingComponent => parent?.enclosingComponent;
|
||||
|
||||
Library get enclosingLibrary => parent?.enclosingLibrary;
|
||||
|
||||
/// Returns the best known source location of the given AST node, or `null` if
|
||||
/// the node is orphaned.
|
||||
///
|
||||
|
@ -468,8 +466,6 @@ class Library extends NamedNode implements Comparable<Library>, FileUriNode {
|
|||
Location _getLocationInEnclosingFile(int offset) {
|
||||
return _getLocationInComponent(enclosingComponent, fileUri, offset);
|
||||
}
|
||||
|
||||
Library get enclosingLibraray => this;
|
||||
}
|
||||
|
||||
/// An import or export declaration in a library.
|
||||
|
|
|
@ -46,6 +46,8 @@ class _FfiUseSiteTransformer extends FfiTransformer {
|
|||
final Map<Field, Procedure> replacedGetters;
|
||||
final Map<Field, Procedure> replacedSetters;
|
||||
|
||||
bool isFfiLibrary;
|
||||
|
||||
_FfiUseSiteTransformer(
|
||||
ClassHierarchy hierarchy,
|
||||
CoreTypes coreTypes,
|
||||
|
@ -54,6 +56,12 @@ class _FfiUseSiteTransformer extends FfiTransformer {
|
|||
this.replacedSetters)
|
||||
: super(hierarchy, coreTypes, diagnosticReporter) {}
|
||||
|
||||
@override
|
||||
TreeNode visitLibrary(Library node) {
|
||||
isFfiLibrary = node == ffiLibrary;
|
||||
return super.visitLibrary(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitClass(Class node) {
|
||||
env.thisType = InterfaceType(node);
|
||||
|
@ -124,7 +132,7 @@ class _FfiUseSiteTransformer extends FfiTransformer {
|
|||
_ensureNativeTypeValid(nativeType, node);
|
||||
_ensureNativeTypeToDartType(nativeType, dartType, node);
|
||||
} else if (target == asFunctionMethod) {
|
||||
if (node.enclosingLibrary == ffiLibrary) {
|
||||
if (isFfiLibrary) {
|
||||
// Library code of dart:ffi uses asFunction to implement
|
||||
// lookupFunction. Since we treat lookupFunction as well, this call
|
||||
// can be generic and still support AOT.
|
||||
|
|
Loading…
Reference in a new issue