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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart

Issue 2691653003: Compute bounds of type variables. (Closed)
Patch Set: Created 3 years, 10 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
Index: pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 20f692c6e6fa81ef86b080172fe0c3e308588b86..02c0edf677aeaf924733a618b9bd1638fbc79743 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -65,6 +65,9 @@ class KernelLibraryBuilder
final List<List> argumentsWithMissingDefaultValues = <List>[];
+ final List<KernelTypeVariableBuilder> boundlessTypeVariables =
+ <KernelTypeVariableBuilder>[];
+
KernelLibraryBuilder(Uri uri, Uri fileUri, Loader loader)
: library = new Library(uri, fileUri: relativizeUri(fileUri)),
super(loader, fileUri);
@@ -201,7 +204,9 @@ class KernelLibraryBuilder
KernelTypeVariableBuilder addTypeVariable(String name,
KernelTypeBuilder bound, int charOffset) {
- return new KernelTypeVariableBuilder(name, this, charOffset, bound);
+ var builder = new KernelTypeVariableBuilder(name, this, charOffset, bound);
+ boundlessTypeVariables.add(builder);
+ return builder;
}
void buildBuilder(Builder builder) {
@@ -311,6 +316,7 @@ class KernelLibraryBuilder
var newVariable = new KernelTypeVariableBuilder(
variable.name, this, variable.charOffset);
copy.add(newVariable);
+ boundlessTypeVariables.add(newVariable);
}
Map<TypeVariableBuilder, TypeBuilder> substitution =
<TypeVariableBuilder, TypeBuilder>{};
@@ -324,6 +330,22 @@ class KernelLibraryBuilder
}
return copy;
}
+
+ int finishTypeVariables(ClassBuilder object) {
+ int count = boundlessTypeVariables.length;
+ for (KernelTypeVariableBuilder builder in boundlessTypeVariables) {
+ builder.finish(object);
+ }
+ boundlessTypeVariables.clear();
+ return count;
+ }
+
+ @override
+ void includePart(KernelLibraryBuilder part) {
+ super.includePart(part);
+ boundlessTypeVariables.addAll(part.boundlessTypeVariables);
+ mixinApplicationClasses.addAll(part.mixinApplicationClasses);
+ }
}
bool isConstructorName(String name, String className) {

Powered by Google App Engine
This is Rietveld 408576698