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

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

Issue 363093004: Use Object::null_object() instead of Object::ZoneHandle() when a null object (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/stub_code_arm64_test.cc » ('j') | 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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 params.num_fixed_parameters++; 1322 params.num_fixed_parameters++;
1323 } 1323 }
1324 ASSERT(desc.PositionalCount() == params.num_fixed_parameters); 1324 ASSERT(desc.PositionalCount() == params.num_fixed_parameters);
1325 1325
1326 // Named parameters. 1326 // Named parameters.
1327 for (; i < desc.Count(); ++i) { 1327 for (; i < desc.Count(); ++i) {
1328 ParamDesc p; 1328 ParamDesc p;
1329 intptr_t index = i - desc.PositionalCount(); 1329 intptr_t index = i - desc.PositionalCount();
1330 p.name = &String::ZoneHandle(I, desc.NameAt(index)); 1330 p.name = &String::ZoneHandle(I, desc.NameAt(index));
1331 p.type = &Type::ZoneHandle(I, Type::DynamicType()); 1331 p.type = &Type::ZoneHandle(I, Type::DynamicType());
1332 p.default_value = &Object::ZoneHandle(); 1332 p.default_value = &Object::null_object();
1333 params.parameters->Add(p); 1333 params.parameters->Add(p);
1334 params.num_optional_parameters++; 1334 params.num_optional_parameters++;
1335 params.has_optional_named_parameters = true; 1335 params.has_optional_named_parameters = true;
1336 } 1336 }
1337 ASSERT(desc.NamedCount() == params.num_optional_parameters); 1337 ASSERT(desc.NamedCount() == params.num_optional_parameters);
1338 1338
1339 SetupDefaultsForOptionalParams(&params, default_values); 1339 SetupDefaultsForOptionalParams(&params, default_values);
1340 1340
1341 // Build local scope for function and populate with the formal parameters. 1341 // Build local scope for function and populate with the formal parameters.
1342 OpenFunctionBlock(func); 1342 OpenFunctionBlock(func);
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 SkipExpr(); 1690 SkipExpr();
1691 } else { 1691 } else {
1692 const Object& const_value = ParseConstExpr()->literal(); 1692 const Object& const_value = ParseConstExpr()->literal();
1693 parameter.default_value = &const_value; 1693 parameter.default_value = &const_value;
1694 } 1694 }
1695 } else { 1695 } else {
1696 if (params->has_optional_positional_parameters || 1696 if (params->has_optional_positional_parameters ||
1697 params->has_optional_named_parameters) { 1697 params->has_optional_named_parameters) {
1698 // Implicit default value is null. 1698 // Implicit default value is null.
1699 params->num_optional_parameters++; 1699 params->num_optional_parameters++;
1700 parameter.default_value = &Object::ZoneHandle(); 1700 parameter.default_value = &Object::null_object();
1701 } else { 1701 } else {
1702 params->num_fixed_parameters++; 1702 params->num_fixed_parameters++;
1703 ASSERT(params->num_optional_parameters == 0); 1703 ASSERT(params->num_optional_parameters == 0);
1704 } 1704 }
1705 } 1705 }
1706 if (parameter.type->IsVoidType()) { 1706 if (parameter.type->IsVoidType()) {
1707 ReportError("parameter '%s' may not be 'void'", 1707 ReportError("parameter '%s' may not be 'void'",
1708 parameter.name->ToCString()); 1708 parameter.name->ToCString());
1709 } 1709 }
1710 if (params->implicitly_final) { 1710 if (params->implicitly_final) {
(...skipping 9348 matching lines...) Expand 10 before | Expand all | Expand 10 after
11059 void Parser::SkipQualIdent() { 11059 void Parser::SkipQualIdent() {
11060 ASSERT(IsIdentifier()); 11060 ASSERT(IsIdentifier());
11061 ConsumeToken(); 11061 ConsumeToken();
11062 if (CurrentToken() == Token::kPERIOD) { 11062 if (CurrentToken() == Token::kPERIOD) {
11063 ConsumeToken(); // Consume the kPERIOD token. 11063 ConsumeToken(); // Consume the kPERIOD token.
11064 ExpectIdentifier("identifier expected after '.'"); 11064 ExpectIdentifier("identifier expected after '.'");
11065 } 11065 }
11066 } 11066 }
11067 11067
11068 } // namespace dart 11068 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/stub_code_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698