| 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 4300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4311 | 4311 |
| 4312 // Make sure that the instantiator is captured. | 4312 // Make sure that the instantiator is captured. |
| 4313 if ((signature_class.NumTypeParameters() > 0) && | 4313 if ((signature_class.NumTypeParameters() > 0) && |
| 4314 (current_block_->scope->function_level() > 0)) { | 4314 (current_block_->scope->function_level() > 0)) { |
| 4315 CaptureReceiver(); | 4315 CaptureReceiver(); |
| 4316 } | 4316 } |
| 4317 | 4317 |
| 4318 // Since the signature type is cached by the signature class, it may have | 4318 // Since the signature type is cached by the signature class, it may have |
| 4319 // been finalized already. | 4319 // been finalized already. |
| 4320 Type& signature_type = Type::Handle(signature_class.SignatureType()); | 4320 Type& signature_type = Type::Handle(signature_class.SignatureType()); |
| 4321 const AbstractTypeArguments& signature_type_arguments = | 4321 AbstractTypeArguments& signature_type_arguments = |
| 4322 AbstractTypeArguments::Handle(signature_type.arguments()); | 4322 AbstractTypeArguments::Handle(signature_type.arguments()); |
| 4323 | 4323 |
| 4324 if (!signature_type.IsFinalized()) { | 4324 if (!signature_type.IsFinalized()) { |
| 4325 signature_type ^= ClassFinalizer::FinalizeType( | 4325 signature_type ^= ClassFinalizer::FinalizeType( |
| 4326 signature_class, signature_type, ClassFinalizer::kCanonicalize); | 4326 signature_class, signature_type, ClassFinalizer::kCanonicalize); |
| 4327 |
| 4327 // The call to ClassFinalizer::FinalizeType may have | 4328 // The call to ClassFinalizer::FinalizeType may have |
| 4328 // extended the vector of type arguments. | 4329 // extended the vector of type arguments. |
| 4329 ASSERT(signature_type_arguments.IsNull() || | 4330 signature_type_arguments = signature_type.arguments(); |
| 4331 ASSERT(signature_type.IsMalformed() || |
| 4332 signature_type_arguments.IsNull() || |
| 4330 (signature_type_arguments.Length() == | 4333 (signature_type_arguments.Length() == |
| 4331 signature_class.NumTypeArguments())); | 4334 signature_class.NumTypeArguments())); |
| 4335 |
| 4332 // The signature_class should not have changed. | 4336 // The signature_class should not have changed. |
| 4333 ASSERT(signature_type.type_class() == signature_class.raw()); | 4337 ASSERT(signature_type.IsMalformed() || |
| 4338 (signature_type.type_class() == signature_class.raw())); |
| 4334 } | 4339 } |
| 4335 | 4340 |
| 4336 if (variable_name != NULL) { | 4341 if (variable_name != NULL) { |
| 4337 // Patch the function type of the variable now that the signature is known. | 4342 // Patch the function type of the variable now that the signature is known. |
| 4338 function_type.set_type_class(signature_class); | 4343 function_type.set_type_class(signature_class); |
| 4339 function_type.set_arguments(signature_type_arguments); | 4344 function_type.set_arguments(signature_type_arguments); |
| 4340 | 4345 |
| 4346 // Mark the function type as malformed if the signature type is malformed. |
| 4347 if (signature_type.IsMalformed()) { |
| 4348 const Error& error = Error::Handle(signature_type.malformed_error()); |
| 4349 function_type.set_malformed_error(error); |
| 4350 } |
| 4351 |
| 4341 // The function variable type should have been patched above. | 4352 // The function variable type should have been patched above. |
| 4342 ASSERT((function_variable == NULL) || | 4353 ASSERT((function_variable == NULL) || |
| 4343 (function_variable->type().raw() == function_type.raw())); | 4354 (function_variable->type().raw() == function_type.raw())); |
| 4344 } | 4355 } |
| 4345 | 4356 |
| 4346 // The code generator does not compile the closure function when visiting | 4357 // The code generator does not compile the closure function when visiting |
| 4347 // a ClosureNode. The generated code allocates a new Closure object containing | 4358 // a ClosureNode. The generated code allocates a new Closure object containing |
| 4348 // the current context. The type of the Closure object refers to the closure | 4359 // the current context. The type of the Closure object refers to the closure |
| 4349 // function, which will be compiled on first invocation of the closure object. | 4360 // function, which will be compiled on first invocation of the closure object. |
| 4350 // Therefore, we ignore the parsed default_parameter_values and the | 4361 // Therefore, we ignore the parsed default_parameter_values and the |
| (...skipping 4304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8655 void Parser::SkipQualIdent() { | 8666 void Parser::SkipQualIdent() { |
| 8656 ASSERT(IsIdentifier()); | 8667 ASSERT(IsIdentifier()); |
| 8657 ConsumeToken(); | 8668 ConsumeToken(); |
| 8658 if (CurrentToken() == Token::kPERIOD) { | 8669 if (CurrentToken() == Token::kPERIOD) { |
| 8659 ConsumeToken(); // Consume the kPERIOD token. | 8670 ConsumeToken(); // Consume the kPERIOD token. |
| 8660 ExpectIdentifier("identifier expected after '.'"); | 8671 ExpectIdentifier("identifier expected after '.'"); |
| 8661 } | 8672 } |
| 8662 } | 8673 } |
| 8663 | 8674 |
| 8664 } // namespace dart | 8675 } // namespace dart |
| OLD | NEW |