Index: pkg/front_end/lib/src/fasta/builder/member_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/builder/member_builder.dart b/pkg/front_end/lib/src/fasta/builder/member_builder.dart |
index f21dff6da0f44ad0f979b1905297e28ded3f83a3..0838145468efdc6721f537d919e13fdcebae6677 100644 |
--- a/pkg/front_end/lib/src/fasta/builder/member_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/builder/member_builder.dart |
@@ -4,7 +4,8 @@ |
library fasta.member_builder; |
-import 'builder.dart' show Builder, ClassBuilder, ModifierBuilder; |
+import 'builder.dart' |
+ show Builder, ClassBuilder, LibraryBuilder, ModifierBuilder; |
abstract class MemberBuilder extends ModifierBuilder { |
/// For top-level members, the parent is set correctly during |
@@ -28,6 +29,16 @@ abstract class MemberBuilder extends ModifierBuilder { |
bool get isRedirectingGenerativeConstructor => false; |
+ LibraryBuilder get library { |
+ if (parent is LibraryBuilder) { |
+ LibraryBuilder library = parent; |
+ return library.partOfLibrary ?? library; |
+ } else { |
+ ClassBuilder cls = parent; |
+ return cls.library; |
+ } |
+ } |
+ |
@override |
String get fullNameForErrors => name; |
} |