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

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

Issue 2866593003: Add an optional bound to type parameter references (Closed)
Patch Set: Don't leak the bound if it ever becomes non-null Created 3 years, 7 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/kernel/binary.md ('k') | pkg/kernel/lib/binary/ast_from_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 fa2d18086786c490994e0d73ab078909a8e60dbc..72ab24dc7fb1254fbc1a7a137b64738752b29b35 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -4103,10 +4103,21 @@ class NamedType extends Node implements Comparable<NamedType> {
final Map<TypeParameter, int> _temporaryHashCodeTable = <TypeParameter, int>{};
/// Reference to a type variable.
+///
+/// A type variable has an optional bound because type promotion can change the
+/// bound. A bound of `null` indicates that the bound has not been promoted and
+/// is the same as the [TypeParameter]'s bound. This allows one to detect
+/// whether the bound has been promoted.
class TypeParameterType extends DartType {
TypeParameter parameter;
- TypeParameterType(this.parameter);
+ /// An optional promoted bound on the type parameter.
+ ///
+ /// 'null' indicates that the type parameter's bound has not been promoted and
+ /// is therefore the same as the bound of [parameter].
+ DartType bound;
+
+ TypeParameterType(this.parameter, [this.bound]);
accept(DartTypeVisitor v) => v.visitTypeParameterType(this);
« no previous file with comments | « pkg/kernel/binary.md ('k') | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698