| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3423 ExpectIdentifier("name expected"); | 3423 ExpectIdentifier("name expected"); |
| 3424 } | 3424 } |
| 3425 SkipTypeArguments(); | 3425 SkipTypeArguments(); |
| 3426 } | 3426 } |
| 3427 } | 3427 } |
| 3428 | 3428 |
| 3429 | 3429 |
| 3430 void Parser::ParseTypeParameters(const Class& cls) { | 3430 void Parser::ParseTypeParameters(const Class& cls) { |
| 3431 TRACE_PARSER("ParseTypeParameters"); | 3431 TRACE_PARSER("ParseTypeParameters"); |
| 3432 if (CurrentToken() == Token::kLT) { | 3432 if (CurrentToken() == Token::kLT) { |
| 3433 Isolate* isolate = Isolate::Current(); |
| 3433 const GrowableObjectArray& type_parameters_array = | 3434 const GrowableObjectArray& type_parameters_array = |
| 3434 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 3435 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 3435 intptr_t index = 0; | 3436 intptr_t index = 0; |
| 3436 TypeParameter& type_parameter = TypeParameter::Handle(); | 3437 TypeParameter& type_parameter = TypeParameter::Handle(); |
| 3437 TypeParameter& existing_type_parameter = TypeParameter::Handle(); | 3438 TypeParameter& existing_type_parameter = TypeParameter::Handle(); |
| 3438 String& existing_type_parameter_name = String::Handle(); | 3439 String& existing_type_parameter_name = String::Handle(); |
| 3439 AbstractType& type_parameter_bound = Type::Handle(); | 3440 AbstractType& type_parameter_bound = Type::Handle(); |
| 3440 do { | 3441 do { |
| 3441 ConsumeToken(); | 3442 ConsumeToken(); |
| 3442 if (CurrentToken() != Token::kIDENT) { | 3443 if (CurrentToken() != Token::kIDENT) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3455 } | 3456 } |
| 3456 ConsumeToken(); | 3457 ConsumeToken(); |
| 3457 if (CurrentToken() == Token::kEXTENDS) { | 3458 if (CurrentToken() == Token::kEXTENDS) { |
| 3458 ConsumeToken(); | 3459 ConsumeToken(); |
| 3459 // A bound may refer to the owner of the type parameter it applies to, | 3460 // A bound may refer to the owner of the type parameter it applies to, |
| 3460 // i.e. to the class or interface currently being parsed. | 3461 // i.e. to the class or interface currently being parsed. |
| 3461 // Postpone resolution in order to avoid resolving the class and its | 3462 // Postpone resolution in order to avoid resolving the class and its |
| 3462 // type parameters, as they are not fully parsed yet. | 3463 // type parameters, as they are not fully parsed yet. |
| 3463 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); | 3464 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); |
| 3464 } else { | 3465 } else { |
| 3465 type_parameter_bound = Type::DynamicType(); | 3466 type_parameter_bound = isolate->object_store()->object_type(); |
| 3466 } | 3467 } |
| 3467 type_parameter = TypeParameter::New(cls, | 3468 type_parameter = TypeParameter::New(cls, |
| 3468 index, | 3469 index, |
| 3469 type_parameter_name, | 3470 type_parameter_name, |
| 3470 type_parameter_bound, | 3471 type_parameter_bound, |
| 3471 type_parameter_pos); | 3472 type_parameter_pos); |
| 3472 type_parameters_array.Add(type_parameter); | 3473 type_parameters_array.Add(type_parameter); |
| 3473 index++; | 3474 index++; |
| 3474 } while (CurrentToken() == Token::kCOMMA); | 3475 } while (CurrentToken() == Token::kCOMMA); |
| 3475 Token::Kind token = CurrentToken(); | 3476 Token::Kind token = CurrentToken(); |
| (...skipping 5858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9334 void Parser::SkipQualIdent() { | 9335 void Parser::SkipQualIdent() { |
| 9335 ASSERT(IsIdentifier()); | 9336 ASSERT(IsIdentifier()); |
| 9336 ConsumeToken(); | 9337 ConsumeToken(); |
| 9337 if (CurrentToken() == Token::kPERIOD) { | 9338 if (CurrentToken() == Token::kPERIOD) { |
| 9338 ConsumeToken(); // Consume the kPERIOD token. | 9339 ConsumeToken(); // Consume the kPERIOD token. |
| 9339 ExpectIdentifier("identifier expected after '.'"); | 9340 ExpectIdentifier("identifier expected after '.'"); |
| 9340 } | 9341 } |
| 9341 } | 9342 } |
| 9342 | 9343 |
| 9343 } // namespace dart | 9344 } // namespace dart |
| OLD | NEW |