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

Unified Diff: lib/transformations/erasure.dart

Issue 2492453002: Erasure fix: Replace type parameters with dynamic instead of Object. (Closed)
Patch Set: Created 4 years, 1 month 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: lib/transformations/erasure.dart
diff --git a/lib/transformations/erasure.dart b/lib/transformations/erasure.dart
index a7aa8d87e9a830e4862ba9f23e92b7968cf42e52..d2cb413e9e994b17ccca167f626badcb1cb39fe5 100644
--- a/lib/transformations/erasure.dart
+++ b/lib/transformations/erasure.dart
@@ -76,13 +76,19 @@ class Erasure extends Transformer {
return node;
}
+ bool isObject(DartType type) {
+ return type is InterfaceType && type.classNode.supertype == null;
+ }
+
@override
visitFunctionNode(FunctionNode node) {
for (var parameter in node.typeParameters) {
substitution[parameter] = const DynamicType();
}
for (var parameter in node.typeParameters) {
- substitution[parameter] = substitute(parameter.bound, substitution);
+ if (!isObject(parameter.bound)) {
+ substitution[parameter] = substitute(parameter.bound, substitution);
+ }
}
node.transformChildren(this);
node.typeParameters.forEach(substitution.remove);
« 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