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

Unified Diff: runtime/vm/parser.cc

Issue 10878042: Propagate type of list literal from parser to ast, graph, and optimizer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | 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 11283)
+++ runtime/vm/parser.cc (working copy)
@@ -1254,7 +1254,8 @@
// TODO(regis): This will change once mirrors are supported.
arguments->Add(new LiteralNode(args_pos, function_name));
// The third argument is an array containing the original function arguments.
- ArrayNode* args_array = new ArrayNode(args_pos, TypeArguments::ZoneHandle());
+ ArrayNode* args_array = new ArrayNode(
+ args_pos, Type::ZoneHandle(Type::ListInterface()));
for (intptr_t i = 1; i < function_args.length(); i++) {
args_array->AddElement(function_args.NodeAt(i));
}
@@ -8060,10 +8061,16 @@
}
}
ASSERT(type_arguments.IsNull() || (type_arguments.Length() == 1));
+ const Class& list_class = Class::Handle(
+ Type::Handle(Type::ListInterface()).type_class());
+ Type& type = Type::ZoneHandle(
+ Type::New(list_class, type_arguments, type_pos));
+ type ^= ClassFinalizer::FinalizeType(
+ current_class(), type, ClassFinalizer::kCanonicalize);
+ ArrayNode* list = new ArrayNode(TokenPos(), type);
// Parse the list elements. Note: there may be an optional extra
// comma after the last element.
- ArrayNode* list = new ArrayNode(TokenPos(), type_arguments);
if (!is_empty_literal) {
const bool saved_mode = SetAllowFunctionLiterals(true);
const String& dst_name = String::ZoneHandle(Symbols::ListLiteralElement());
@@ -8244,12 +8251,13 @@
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.
// The kv_pair array is temporary and of element type Dynamic. It is passed
// to the factory to initialize a properly typed map.
ArrayNode* kv_pairs =
- new ArrayNode(TokenPos(), TypeArguments::ZoneHandle());
+ new ArrayNode(TokenPos(), Type::ZoneHandle(Type::ListInterface()));
+
+ // Parse the map entries. Note: there may be an optional extra
+ // comma after the last entry.
const String& dst_name = String::ZoneHandle(Symbols::ListLiteralElement());
while (CurrentToken() != Token::kRBRACE) {
AstNode* key = NULL;
@@ -8707,7 +8715,8 @@
}
// String interpolation needed.
bool is_compiletime_const = true;
- ArrayNode* values = new ArrayNode(TokenPos(), TypeArguments::ZoneHandle());
+ ArrayNode* values = new ArrayNode(TokenPos(),
+ Type::ZoneHandle(Type::ListInterface()));
while (CurrentToken() == Token::kSTRING) {
values->AddElement(new LiteralNode(TokenPos(), *CurrentLiteral()));
ConsumeToken();
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698