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

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
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 2130)
+++ 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);
}
}
@@ -6816,6 +6823,7 @@
}
}
ASSERT(map_type_arguments.IsNull() || (map_type_arguments.Length() == 2));
+ map_type_arguments ^= map_type_arguments.Canonicalize();
// Parse the map entries. Note: there may be an optional extra
// comma after the last entry.
@@ -6936,8 +6944,10 @@
}
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);
+ return new ConstructorCallNode(literal_pos,
+ map_type_arguments,
+ literal_map_factory,
+ factory_param);
}
}
@@ -7144,6 +7154,7 @@
type_arguments = type.arguments();
}
+ type_arguments ^= type_arguments.Canonicalize();
// Make the constructor call.
AstNode* new_object = NULL;
if (is_const) {
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698