Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Issue 2788923002: Add assertion on addImplementationBuilder. (Closed)
Patch Set: Add comment. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698