| 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 9170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9181 } | 9181 } |
| 9182 } | 9182 } |
| 9183 return expr; | 9183 return expr; |
| 9184 } | 9184 } |
| 9185 | 9185 |
| 9186 | 9186 |
| 9187 AstNode* Parser::ParseAwaitableExpr(bool require_compiletime_const, | 9187 AstNode* Parser::ParseAwaitableExpr(bool require_compiletime_const, |
| 9188 bool consume_cascades, | 9188 bool consume_cascades, |
| 9189 SequenceNode** await_preamble) { | 9189 SequenceNode** await_preamble) { |
| 9190 TRACE_PARSER("ParseAwaitableExpr"); | 9190 TRACE_PARSER("ParseAwaitableExpr"); |
| 9191 parsed_function()->reset_have_seen_await(); | 9191 BoolScope saved_seen_await(&parsed_function()->have_seen_await_expr_, false); |
| 9192 AstNode* expr = ParseExpr(require_compiletime_const, consume_cascades); | 9192 AstNode* expr = ParseExpr(require_compiletime_const, consume_cascades); |
| 9193 if (parsed_function()->have_seen_await()) { | 9193 if (parsed_function()->have_seen_await()) { |
| 9194 // Make sure we do not reuse the scope to avoid creating contexts that we | 9194 // Make sure we do not reuse the scope to avoid creating contexts that we |
| 9195 // are unaware of, i.e, creating contexts that have already been covered. | 9195 // are unaware of, i.e, creating contexts that have already been covered. |
| 9196 // See FlowGraphBuilder::VisitSequenceNode() for details on when contexts | 9196 // See FlowGraphBuilder::VisitSequenceNode() for details on when contexts |
| 9197 // are created. | 9197 // are created. |
| 9198 OpenBlock(); | 9198 OpenBlock(); |
| 9199 AwaitTransformer at(current_block_->statements, | 9199 AwaitTransformer at(current_block_->statements, |
| 9200 parsed_function(), | 9200 parsed_function(), |
| 9201 async_temp_scope_); | 9201 async_temp_scope_); |
| 9202 AstNode* result = at.Transform(expr); | 9202 AstNode* result = at.Transform(expr); |
| 9203 SequenceNode* preamble = CloseBlock(); | 9203 SequenceNode* preamble = CloseBlock(); |
| 9204 if (await_preamble == NULL) { | 9204 if (await_preamble == NULL) { |
| 9205 current_block_->statements->Add(preamble); | 9205 current_block_->statements->Add(preamble); |
| 9206 } else { | 9206 } else { |
| 9207 *await_preamble = preamble; | 9207 *await_preamble = preamble; |
| 9208 } | 9208 } |
| 9209 parsed_function()->reset_have_seen_await(); | |
| 9210 return result; | 9209 return result; |
| 9211 } | 9210 } |
| 9212 return expr; | 9211 return expr; |
| 9213 } | 9212 } |
| 9214 | 9213 |
| 9215 | 9214 |
| 9216 AstNode* Parser::ParseExpr(bool require_compiletime_const, | 9215 AstNode* Parser::ParseExpr(bool require_compiletime_const, |
| 9217 bool consume_cascades) { | 9216 bool consume_cascades) { |
| 9218 TRACE_PARSER("ParseExpr"); | 9217 TRACE_PARSER("ParseExpr"); |
| 9219 String* expr_ident = | 9218 String* expr_ident = |
| (...skipping 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12138 void Parser::SkipQualIdent() { | 12137 void Parser::SkipQualIdent() { |
| 12139 ASSERT(IsIdentifier()); | 12138 ASSERT(IsIdentifier()); |
| 12140 ConsumeToken(); | 12139 ConsumeToken(); |
| 12141 if (CurrentToken() == Token::kPERIOD) { | 12140 if (CurrentToken() == Token::kPERIOD) { |
| 12142 ConsumeToken(); // Consume the kPERIOD token. | 12141 ConsumeToken(); // Consume the kPERIOD token. |
| 12143 ExpectIdentifier("identifier expected after '.'"); | 12142 ExpectIdentifier("identifier expected after '.'"); |
| 12144 } | 12143 } |
| 12145 } | 12144 } |
| 12146 | 12145 |
| 12147 } // namespace dart | 12146 } // namespace dart |
| OLD | NEW |