| OLD | NEW |
| 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 "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 var_seen = true; | 1416 var_seen = true; |
| 1417 // The parameter type is the 'dynamic' type. | 1417 // The parameter type is the 'dynamic' type. |
| 1418 parameter.type = &Type::ZoneHandle(Type::DynamicType()); | 1418 parameter.type = &Type::ZoneHandle(Type::DynamicType()); |
| 1419 } | 1419 } |
| 1420 if (CurrentToken() == Token::kTHIS) { | 1420 if (CurrentToken() == Token::kTHIS) { |
| 1421 ConsumeToken(); | 1421 ConsumeToken(); |
| 1422 ExpectToken(Token::kPERIOD); | 1422 ExpectToken(Token::kPERIOD); |
| 1423 this_seen = true; | 1423 this_seen = true; |
| 1424 parameter.is_field_initializer = true; | 1424 parameter.is_field_initializer = true; |
| 1425 } | 1425 } |
| 1426 if (params->implicitly_final) { | |
| 1427 parameter.is_final = true; | |
| 1428 } | |
| 1429 if ((parameter.type == NULL) && (CurrentToken() == Token::kVOID)) { | 1426 if ((parameter.type == NULL) && (CurrentToken() == Token::kVOID)) { |
| 1430 ConsumeToken(); | 1427 ConsumeToken(); |
| 1431 // This must later be changed to a closure type if we recognize | 1428 // This must later be changed to a closure type if we recognize |
| 1432 // a closure/function type parameter. We check this at the end | 1429 // a closure/function type parameter. We check this at the end |
| 1433 // of ParseFormalParameter. | 1430 // of ParseFormalParameter. |
| 1434 parameter.type = &Type::ZoneHandle(Type::VoidType()); | 1431 parameter.type = &Type::ZoneHandle(Type::VoidType()); |
| 1435 } | 1432 } |
| 1436 if (parameter.type == NULL) { | 1433 if (parameter.type == NULL) { |
| 1437 // At this point, we must see an identifier for the type or the | 1434 // At this point, we must see an identifier for the type or the |
| 1438 // function parameter. | 1435 // function parameter. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 params->num_optional_parameters++; | 1575 params->num_optional_parameters++; |
| 1579 parameter.default_value = &Object::ZoneHandle(); | 1576 parameter.default_value = &Object::ZoneHandle(); |
| 1580 } else { | 1577 } else { |
| 1581 params->num_fixed_parameters++; | 1578 params->num_fixed_parameters++; |
| 1582 ASSERT(params->num_optional_parameters == 0); | 1579 ASSERT(params->num_optional_parameters == 0); |
| 1583 } | 1580 } |
| 1584 } | 1581 } |
| 1585 if (parameter.type->IsVoidType()) { | 1582 if (parameter.type->IsVoidType()) { |
| 1586 ErrorMsg("parameter '%s' may not be 'void'", parameter.name->ToCString()); | 1583 ErrorMsg("parameter '%s' may not be 'void'", parameter.name->ToCString()); |
| 1587 } | 1584 } |
| 1585 if (params->implicitly_final) { |
| 1586 parameter.is_final = true; |
| 1587 } |
| 1588 params->parameters->Add(parameter); | 1588 params->parameters->Add(parameter); |
| 1589 } | 1589 } |
| 1590 | 1590 |
| 1591 | 1591 |
| 1592 // Parses a sequence of normal or optional formal parameters. | 1592 // Parses a sequence of normal or optional formal parameters. |
| 1593 void Parser::ParseFormalParameters(bool allow_explicit_default_values, | 1593 void Parser::ParseFormalParameters(bool allow_explicit_default_values, |
| 1594 bool evaluate_metadata, | 1594 bool evaluate_metadata, |
| 1595 ParamList* params) { | 1595 ParamList* params) { |
| 1596 TRACE_PARSER("ParseFormalParameters"); | 1596 TRACE_PARSER("ParseFormalParameters"); |
| 1597 do { | 1597 do { |
| (...skipping 8900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10498 void Parser::SkipQualIdent() { | 10498 void Parser::SkipQualIdent() { |
| 10499 ASSERT(IsIdentifier()); | 10499 ASSERT(IsIdentifier()); |
| 10500 ConsumeToken(); | 10500 ConsumeToken(); |
| 10501 if (CurrentToken() == Token::kPERIOD) { | 10501 if (CurrentToken() == Token::kPERIOD) { |
| 10502 ConsumeToken(); // Consume the kPERIOD token. | 10502 ConsumeToken(); // Consume the kPERIOD token. |
| 10503 ExpectIdentifier("identifier expected after '.'"); | 10503 ExpectIdentifier("identifier expected after '.'"); |
| 10504 } | 10504 } |
| 10505 } | 10505 } |
| 10506 | 10506 |
| 10507 } // namespace dart | 10507 } // namespace dart |
| OLD | NEW |