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 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 // Don't add a modifier to the closure representing the body of | 3174 // Don't add a modifier to the closure representing the body of |
3175 // the asynchronous function or generator. | 3175 // the asynchronous function or generator. |
3176 func.set_modifier(func_modifier); | 3176 func.set_modifier(func_modifier); |
3177 } | 3177 } |
3178 | 3178 |
3179 OpenBlock(); // Open a nested scope for the outermost function block. | 3179 OpenBlock(); // Open a nested scope for the outermost function block. |
3180 | 3180 |
3181 Function& generated_body_closure = Function::ZoneHandle(Z); | 3181 Function& generated_body_closure = Function::ZoneHandle(Z); |
3182 if (func.IsAsyncFunction()) { | 3182 if (func.IsAsyncFunction()) { |
3183 ASSERT(!func.is_generated_body()); | 3183 ASSERT(!func.is_generated_body()); |
3184 // Must show frame for checked mode return type error. | 3184 // The code of an async function is synthesized. Disable debugging. |
3185 ASSERT(func.is_debuggable()); | 3185 func.set_is_debuggable(false); |
3186 generated_body_closure = OpenAsyncFunction(func.token_pos()); | 3186 generated_body_closure = OpenAsyncFunction(func.token_pos()); |
3187 } else if (func.IsAsyncClosure()) { | 3187 } else if (func.IsAsyncClosure()) { |
3188 // The closure containing the body of an async function is debuggable. | 3188 // The closure containing the body of an async function is debuggable. |
3189 ASSERT(func.is_debuggable()); | 3189 ASSERT(func.is_debuggable()); |
3190 OpenAsyncClosure(); | 3190 OpenAsyncClosure(); |
3191 } else if (func.IsSyncGenerator()) { | 3191 } else if (func.IsSyncGenerator()) { |
3192 // Must show frame for checked mode return type error. | 3192 // The code of a sync generator is synthesized. Disable debugging. |
3193 ASSERT(func.is_debuggable()); | 3193 func.set_is_debuggable(false); |
3194 generated_body_closure = OpenSyncGeneratorFunction(func.token_pos()); | 3194 generated_body_closure = OpenSyncGeneratorFunction(func.token_pos()); |
3195 } else if (func.IsSyncGenClosure()) { | 3195 } else if (func.IsSyncGenClosure()) { |
3196 // The closure containing the body of a sync generator is debuggable. | 3196 // The closure containing the body of a sync generator is debuggable. |
3197 ASSERT(func.is_debuggable()); | 3197 ASSERT(func.is_debuggable()); |
3198 async_temp_scope_ = current_block_->scope; | 3198 async_temp_scope_ = current_block_->scope; |
3199 } else if (func.IsAsyncGenerator()) { | 3199 } else if (func.IsAsyncGenerator()) { |
3200 // Must show frame for checked mode return type error. | 3200 func.set_is_debuggable(false); |
3201 ASSERT(func.is_debuggable()); | |
3202 generated_body_closure = OpenAsyncGeneratorFunction(func.token_pos()); | 3201 generated_body_closure = OpenAsyncGeneratorFunction(func.token_pos()); |
3203 } else if (func.IsAsyncGenClosure()) { | 3202 } else if (func.IsAsyncGenClosure()) { |
3204 // The closure containing the body of an async* function is debuggable. | 3203 // The closure containing the body of an async* function is debuggable. |
3205 ASSERT(func.is_debuggable()); | 3204 ASSERT(func.is_debuggable()); |
3206 OpenAsyncGeneratorClosure(); | 3205 OpenAsyncGeneratorClosure(); |
3207 } | 3206 } |
3208 | 3207 |
3209 BoolScope allow_await(&this->await_is_keyword_, | 3208 BoolScope allow_await(&this->await_is_keyword_, |
3210 func.IsAsyncOrGenerator() || func.is_generated_body()); | 3209 func.IsAsyncOrGenerator() || func.is_generated_body()); |
3211 intptr_t end_token_pos = 0; | 3210 intptr_t end_token_pos = 0; |
(...skipping 10010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13222 void Parser::SkipQualIdent() { | 13221 void Parser::SkipQualIdent() { |
13223 ASSERT(IsIdentifier()); | 13222 ASSERT(IsIdentifier()); |
13224 ConsumeToken(); | 13223 ConsumeToken(); |
13225 if (CurrentToken() == Token::kPERIOD) { | 13224 if (CurrentToken() == Token::kPERIOD) { |
13226 ConsumeToken(); // Consume the kPERIOD token. | 13225 ConsumeToken(); // Consume the kPERIOD token. |
13227 ExpectIdentifier("identifier expected after '.'"); | 13226 ExpectIdentifier("identifier expected after '.'"); |
13228 } | 13227 } |
13229 } | 13228 } |
13230 | 13229 |
13231 } // namespace dart | 13230 } // namespace dart |
OLD | NEW |