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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 | 311 |
312 void Parser::TryStack::AddNodeForFinallyInlining(AstNode* node) { | 312 void Parser::TryStack::AddNodeForFinallyInlining(AstNode* node) { |
313 inlined_finally_nodes_.Add(node); | 313 inlined_finally_nodes_.Add(node); |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 // For parsing a compilation unit. | 317 // For parsing a compilation unit. |
318 Parser::Parser(const Script& script, const Library& library, intptr_t token_pos) | 318 Parser::Parser(const Script& script, const Library& library, intptr_t token_pos) |
319 : isolate_(Thread::Current()->isolate()), | 319 : isolate_(Thread::Current()->isolate()), |
| 320 thread_(Thread::Current()), |
320 script_(Script::Handle(zone(), script.raw())), | 321 script_(Script::Handle(zone(), script.raw())), |
321 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), | 322 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), |
322 token_pos), | 323 token_pos), |
323 token_kind_(Token::kILLEGAL), | 324 token_kind_(Token::kILLEGAL), |
324 current_block_(NULL), | 325 current_block_(NULL), |
325 is_top_level_(false), | 326 is_top_level_(false), |
326 await_is_keyword_(false), | 327 await_is_keyword_(false), |
327 current_member_(NULL), | 328 current_member_(NULL), |
328 allow_function_literals_(true), | 329 allow_function_literals_(true), |
329 parsed_function_(NULL), | 330 parsed_function_(NULL), |
330 innermost_function_(Function::Handle(zone())), | 331 innermost_function_(Function::Handle(zone())), |
331 literal_token_(LiteralToken::Handle(zone())), | 332 literal_token_(LiteralToken::Handle(zone())), |
332 current_class_(Class::Handle(zone())), | 333 current_class_(Class::Handle(zone())), |
333 library_(Library::Handle(zone(), library.raw())), | 334 library_(Library::Handle(zone(), library.raw())), |
334 try_stack_(NULL), | 335 try_stack_(NULL), |
335 last_used_try_index_(0), | 336 last_used_try_index_(0), |
336 unregister_pending_function_(false), | 337 unregister_pending_function_(false), |
337 async_temp_scope_(NULL), | 338 async_temp_scope_(NULL), |
338 trace_indent_(0) { | 339 trace_indent_(0) { |
339 ASSERT(tokens_iterator_.IsValid()); | 340 ASSERT(tokens_iterator_.IsValid()); |
340 ASSERT(!library.IsNull()); | 341 ASSERT(!library.IsNull()); |
341 } | 342 } |
342 | 343 |
343 | 344 |
344 // For parsing a function. | 345 // For parsing a function. |
345 Parser::Parser(const Script& script, | 346 Parser::Parser(const Script& script, |
346 ParsedFunction* parsed_function, | 347 ParsedFunction* parsed_function, |
347 intptr_t token_position) | 348 intptr_t token_position) |
348 : isolate_(Thread::Current()->isolate()), | 349 : isolate_(Thread::Current()->isolate()), |
| 350 thread_(Thread::Current()), |
349 script_(Script::Handle(zone(), script.raw())), | 351 script_(Script::Handle(zone(), script.raw())), |
350 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), | 352 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), |
351 token_position), | 353 token_position), |
352 token_kind_(Token::kILLEGAL), | 354 token_kind_(Token::kILLEGAL), |
353 current_block_(NULL), | 355 current_block_(NULL), |
354 is_top_level_(false), | 356 is_top_level_(false), |
355 await_is_keyword_(false), | 357 await_is_keyword_(false), |
356 current_member_(NULL), | 358 current_member_(NULL), |
357 allow_function_literals_(true), | 359 allow_function_literals_(true), |
358 parsed_function_(parsed_function), | 360 parsed_function_(parsed_function), |
(...skipping 13266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13625 void Parser::SkipQualIdent() { | 13627 void Parser::SkipQualIdent() { |
13626 ASSERT(IsIdentifier()); | 13628 ASSERT(IsIdentifier()); |
13627 ConsumeToken(); | 13629 ConsumeToken(); |
13628 if (CurrentToken() == Token::kPERIOD) { | 13630 if (CurrentToken() == Token::kPERIOD) { |
13629 ConsumeToken(); // Consume the kPERIOD token. | 13631 ConsumeToken(); // Consume the kPERIOD token. |
13630 ExpectIdentifier("identifier expected after '.'"); | 13632 ExpectIdentifier("identifier expected after '.'"); |
13631 } | 13633 } |
13632 } | 13634 } |
13633 | 13635 |
13634 } // namespace dart | 13636 } // namespace dart |
OLD | NEW |