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

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

Issue 2788923002: Add assertion on addImplementationBuilder. (Closed)
Patch Set: Created 3 years, 9 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..06b798baa5cd545be6de5f2d1fe3b82b2c24126b 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;
karlklose 2017/04/03 06:48:14 Could you add a comment here and/or to addImplemen
ahe 2017/04/04 09:46:44 Done.
+
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,12 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
addBuilder(name, builder, charOffset);
buildBuilder(builder);
}
+ canAddImplementationBuilders = false;
return null;
}
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