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

Side by Side Diff: runtime/vm/parser.cc

Issue 430873002: Fix usage of empty array while parsing array literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 10010 matching lines...) Expand 10 before | Expand all | Expand 10 after
10021 factory_class, factory_type_args, type_pos, Heap::kNew)); 10021 factory_class, factory_type_args, type_pos, Heap::kNew));
10022 factory_type ^= ClassFinalizer::FinalizeType( 10022 factory_type ^= ClassFinalizer::FinalizeType(
10023 current_class(), factory_type, ClassFinalizer::kFinalize); 10023 current_class(), factory_type, ClassFinalizer::kFinalize);
10024 factory_type_args = factory_type.arguments(); 10024 factory_type_args = factory_type.arguments();
10025 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); 10025 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments());
10026 } 10026 }
10027 factory_type_args = factory_type_args.Canonicalize(); 10027 factory_type_args = factory_type_args.Canonicalize();
10028 ArgumentListNode* factory_param = new(I) ArgumentListNode( 10028 ArgumentListNode* factory_param = new(I) ArgumentListNode(
10029 literal_pos); 10029 literal_pos);
10030 if (element_list.length() == 0) { 10030 if (element_list.length() == 0) {
10031 // TODO(srdjan): Use Object::empty_array once issue 9871 has been fixed.
10032 Array& empty_array = Array::ZoneHandle(I, Object::empty_array().raw());
10033 LiteralNode* empty_array_literal = 10031 LiteralNode* empty_array_literal =
10034 new(I) LiteralNode(TokenPos(), empty_array); 10032 new(I) LiteralNode(TokenPos(), Object::empty_array());
10035 factory_param->Add(empty_array_literal); 10033 factory_param->Add(empty_array_literal);
10036 } else { 10034 } else {
10037 ArrayNode* list = new(I) ArrayNode(TokenPos(), type, element_list); 10035 ArrayNode* list = new(I) ArrayNode(TokenPos(), type, element_list);
10038 factory_param->Add(list); 10036 factory_param->Add(list);
10039 } 10037 }
10040 return CreateConstructorCallNode(literal_pos, 10038 return CreateConstructorCallNode(literal_pos,
10041 factory_type_args, 10039 factory_type_args,
10042 factory_method, 10040 factory_method,
10043 factory_param); 10041 factory_param);
10044 } 10042 }
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
11325 void Parser::SkipQualIdent() { 11323 void Parser::SkipQualIdent() {
11326 ASSERT(IsIdentifier()); 11324 ASSERT(IsIdentifier());
11327 ConsumeToken(); 11325 ConsumeToken();
11328 if (CurrentToken() == Token::kPERIOD) { 11326 if (CurrentToken() == Token::kPERIOD) {
11329 ConsumeToken(); // Consume the kPERIOD token. 11327 ConsumeToken(); // Consume the kPERIOD token.
11330 ExpectIdentifier("identifier expected after '.'"); 11328 ExpectIdentifier("identifier expected after '.'");
11331 } 11329 }
11332 } 11330 }
11333 11331
11334 } // namespace dart 11332 } // namespace dart
OLDNEW
« 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