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