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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2952883003: Make the kernel API for promoted type parameter bounds less error-prone. (Closed)
Patch Set: Created 3 years, 6 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 | « pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index dcc0285ef761ae0f0e3c3e146f4b52626fbc384f..a6c2f0b912775f025f6edc01cc06d695a4e08a91 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -4244,9 +4244,9 @@ class TypeParameterType extends DartType {
///
/// 'null' indicates that the type parameter's bound has not been promoted and
/// is therefore the same as the bound of [parameter].
- DartType bound;
+ DartType promotedBound;
- TypeParameterType(this.parameter, [this.bound]);
+ TypeParameterType(this.parameter, [this.promotedBound]);
accept(DartTypeVisitor v) => v.visitTypeParameterType(this);
@@ -4257,6 +4257,9 @@ class TypeParameterType extends DartType {
}
int get hashCode => _temporaryHashCodeTable[parameter] ?? parameter.hashCode;
+
+ /// Returns the bound of the type parameter, accounting for promotions.
+ DartType get bound => promotedBound ?? parameter.bound;
}
/// Declaration of a type variable.
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/kernel/lib/binary/ast_to_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698