Index: pkg/front_end/lib/src/fasta/source/source_library_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart |
index 984f1f600e5f6dcb7c2135f54fef13f227bce84f..88fb29feaf16286c3546855669753e2d43783b19 100644 |
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart |
@@ -70,6 +70,8 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R> |
/// for example, [addClass] is called. |
DeclarationBuilder<T> currentDeclaration; |
+ bool canAddImplementationBuilders = false; |
+ |
SourceLibraryBuilder(this.loader, Uri fileUri) |
: fileUri = fileUri, |
super(fileUri) { |
@@ -303,6 +305,7 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R> |
R build() { |
assert(implementationBuilders.isEmpty); |
+ canAddImplementationBuilders = true; |
forEach((String name, Builder builder) { |
do { |
buildBuilder(builder); |
@@ -316,10 +319,16 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R> |
addBuilder(name, builder, charOffset); |
buildBuilder(builder); |
} |
+ canAddImplementationBuilders = false; |
return null; |
} |
+ /// Used to add implementation builder during the call to [build] above. |
+ /// Currently, only anonymous mixins are using implementation builders (see |
+ /// [KernelMixinApplicationBuilder] |
+ /// (../kernel/kernel_mixin_application_builder.dart)). |
void addImplementationBuilder(String name, Builder builder, int charOffset) { |
+ assert(canAddImplementationBuilders, "$uri"); |
implementationBuilders.add([name, builder, charOffset]); |
} |