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

Unified Diff: runtime/vm/parser.cc

Issue 8773026: Canonicalize TypeArguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 2094)
+++ runtime/vm/parser.cc (working copy)
@@ -86,10 +86,13 @@
static RawTypeArguments* NewTypeArguments(
const GrowableArray<AbstractType*>& objs) {
- TypeArguments& a = TypeArguments::Handle(TypeArguments::New(objs.length()));
+ const TypeArguments& a =
+ TypeArguments::Handle(TypeArguments::New(objs.length()));
for (int i = 0; i < objs.length(); i++) {
a.SetTypeAt(i, *objs[i]);
}
+ // Cannot canonicalize TypeArgument yet as its types may not have been
+ // finalized yet.
return a.raw();
}
@@ -6738,8 +6741,12 @@
}
ArgumentListNode* factory_param = new ArgumentListNode(literal_pos);
factory_param->Add(list);
- return new ConstructorCallNode(
- literal_pos, type_arguments, literal_list_factory, factory_param);
+ AbstractTypeArguments& canonical_type_arguments =
+ AbstractTypeArguments::ZoneHandle(type_arguments.Canonicalize());
+ return new ConstructorCallNode(literal_pos,
+ canonical_type_arguments,
+ literal_list_factory,
+ factory_param);
}
}
@@ -6807,7 +6814,7 @@
TypeArguments& type_array = TypeArguments::Handle(TypeArguments::New(2));
type_array.SetTypeAt(0, Type::Handle(Type::StringInterface()));
type_array.SetTypeAt(1, value_type);
- map_type_arguments = type_array.raw();
+ map_type_arguments = type_array.Canonicalize();
regis 2011/12/05 23:16:35 Is this necessary? You canonicalize below as well.
srdjan 2011/12/06 17:24:15 Removed, doing it later
}
if (is_const && !value_type.IsInstantiated()) {
ErrorMsg(type_pos,
@@ -6936,8 +6943,12 @@
}
ArgumentListNode* factory_param = new ArgumentListNode(literal_pos);
factory_param->Add(kv_pairs);
- return new ConstructorCallNode(
- literal_pos, map_type_arguments, literal_map_factory, factory_param);
+ AbstractTypeArguments& canonical_map_type_arguments =
+ AbstractTypeArguments::ZoneHandle(map_type_arguments.Canonicalize());
srdjan 2011/12/06 17:24:15 Reverted this.
+ return new ConstructorCallNode(literal_pos,
+ canonical_map_type_arguments,
+ literal_map_factory,
+ factory_param);
}
}
@@ -7170,8 +7181,10 @@
// Make sure that the instantiator is captured.
CaptureReceiver();
}
+ AbstractTypeArguments& canonical_type_arguments =
+ AbstractTypeArguments::ZoneHandle(type_arguments.Canonicalize());
new_object = new ConstructorCallNode(
- new_pos, type_arguments, constructor, arguments);
+ new_pos, canonical_type_arguments, constructor, arguments);
}
return new_object;
}

Powered by Google App Engine
This is Rietveld 408576698