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 "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 6566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6577 (found_func.token_pos() == func_pos) && | 6577 (found_func.token_pos() == func_pos) && |
6578 (found_func.script() == innermost_function().script()) && | 6578 (found_func.script() == innermost_function().script()) && |
6579 (found_func.parent_function() == innermost_function().raw())) { | 6579 (found_func.parent_function() == innermost_function().raw())) { |
6580 ASSERT(found_func.IsSyncGenClosure()); | 6580 ASSERT(found_func.IsSyncGenClosure()); |
6581 body = found_func.raw(); | 6581 body = found_func.raw(); |
6582 body_closure_name = body.name(); | 6582 body_closure_name = body.name(); |
6583 } else { | 6583 } else { |
6584 // Create the closure containing the body of this generator function. | 6584 // Create the closure containing the body of this generator function. |
6585 String& generator_name = String::Handle(Z, innermost_function().name()); | 6585 String& generator_name = String::Handle(Z, innermost_function().name()); |
6586 body_closure_name = | 6586 body_closure_name = |
6587 String::NewFormatted("<%s_sync_body>", generator_name.ToCString()); | 6587 Symbols::NewFormatted("<%s_sync_body>", generator_name.ToCString()); |
6588 body_closure_name = Symbols::New(body_closure_name); | 6588 body_closure_name = Symbols::New(body_closure_name); |
6589 body = Function::NewClosureFunction(body_closure_name, | 6589 body = Function::NewClosureFunction(body_closure_name, |
6590 innermost_function(), | 6590 innermost_function(), |
6591 func_pos); | 6591 func_pos); |
6592 body.set_is_generated_body(true); | 6592 body.set_is_generated_body(true); |
6593 body.set_result_type(AbstractType::Handle(Type::DynamicType())); | 6593 body.set_result_type(AbstractType::Handle(Type::DynamicType())); |
6594 is_new_closure = true; | 6594 is_new_closure = true; |
6595 } | 6595 } |
6596 | 6596 |
6597 ParamList closure_params; | 6597 ParamList closure_params; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6854 (found_func.token_pos() == async_func_pos) && | 6854 (found_func.token_pos() == async_func_pos) && |
6855 (found_func.script() == innermost_function().script()) && | 6855 (found_func.script() == innermost_function().script()) && |
6856 (found_func.parent_function() == innermost_function().raw())) { | 6856 (found_func.parent_function() == innermost_function().raw())) { |
6857 ASSERT(found_func.IsAsyncGenClosure()); | 6857 ASSERT(found_func.IsAsyncGenClosure()); |
6858 closure = found_func.raw(); | 6858 closure = found_func.raw(); |
6859 } else { | 6859 } else { |
6860 // Create the closure containing the body of this async generator function. | 6860 // Create the closure containing the body of this async generator function. |
6861 const String& async_generator_name = | 6861 const String& async_generator_name = |
6862 String::Handle(Z, innermost_function().name()); | 6862 String::Handle(Z, innermost_function().name()); |
6863 String& closure_name = String::Handle(Z, | 6863 String& closure_name = String::Handle(Z, |
6864 String::NewFormatted("<%s_async_gen_body>", | 6864 Symbols::NewFormatted("<%s_async_gen_body>", |
6865 async_generator_name.ToCString())); | 6865 async_generator_name.ToCString())); |
6866 closure = Function::NewClosureFunction( | 6866 closure = Function::NewClosureFunction( |
6867 String::Handle(Z, Symbols::New(closure_name)), | 6867 String::Handle(Z, Symbols::New(closure_name)), |
6868 innermost_function(), | 6868 innermost_function(), |
6869 async_func_pos); | 6869 async_func_pos); |
6870 closure.set_is_generated_body(true); | 6870 closure.set_is_generated_body(true); |
6871 closure.set_result_type(AbstractType::Handle(Type::DynamicType())); | 6871 closure.set_result_type(AbstractType::Handle(Type::DynamicType())); |
6872 is_new_closure = true; | 6872 is_new_closure = true; |
6873 } | 6873 } |
6874 | 6874 |
6875 ParamList closure_params; | 6875 ParamList closure_params; |
(...skipping 7457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14333 void Parser::SkipQualIdent() { | 14333 void Parser::SkipQualIdent() { |
14334 ASSERT(IsIdentifier()); | 14334 ASSERT(IsIdentifier()); |
14335 ConsumeToken(); | 14335 ConsumeToken(); |
14336 if (CurrentToken() == Token::kPERIOD) { | 14336 if (CurrentToken() == Token::kPERIOD) { |
14337 ConsumeToken(); // Consume the kPERIOD token. | 14337 ConsumeToken(); // Consume the kPERIOD token. |
14338 ExpectIdentifier("identifier expected after '.'"); | 14338 ExpectIdentifier("identifier expected after '.'"); |
14339 } | 14339 } |
14340 } | 14340 } |
14341 | 14341 |
14342 } // namespace dart | 14342 } // namespace dart |
OLD | NEW |