| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 55 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
| 56 enable_checked_mode, | 56 enable_checked_mode, |
| 57 "Enable checked mode."); | 57 "Enable checked mode."); |
| 58 | 58 |
| 59 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 59 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
| 60 checked, | 60 checked, |
| 61 "Enable checked mode."); | 61 "Enable checked mode."); |
| 62 | 62 |
| 63 | 63 |
| 64 // Quick access to the current isolate and zone. | 64 // Quick access to the current isolate and zone. |
| 65 #define I (thread()->isolate()) | 65 #define I (isolate()) |
| 66 #define Z (zone()) | 66 #define Z (zone()) |
| 67 | 67 |
| 68 | 68 |
| 69 #if defined(DEBUG) | 69 #if defined(DEBUG) |
| 70 class TraceParser : public ValueObject { | 70 class TraceParser : public ValueObject { |
| 71 public: | 71 public: |
| 72 TraceParser(intptr_t token_pos, | 72 TraceParser(intptr_t token_pos, |
| 73 const Script& script, | 73 const Script& script, |
| 74 intptr_t* trace_indent, | 74 intptr_t* trace_indent, |
| 75 const char* msg) { | 75 const char* msg) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 }; | 311 }; |
| 312 | 312 |
| 313 | 313 |
| 314 void Parser::TryStack::AddNodeForFinallyInlining(AstNode* node) { | 314 void Parser::TryStack::AddNodeForFinallyInlining(AstNode* node) { |
| 315 inlined_finally_nodes_.Add(node); | 315 inlined_finally_nodes_.Add(node); |
| 316 } | 316 } |
| 317 | 317 |
| 318 | 318 |
| 319 // For parsing a compilation unit. | 319 // For parsing a compilation unit. |
| 320 Parser::Parser(const Script& script, const Library& library, intptr_t token_pos) | 320 Parser::Parser(const Script& script, const Library& library, intptr_t token_pos) |
| 321 : thread_(Thread::Current()), | 321 : isolate_(Thread::Current()->isolate()), |
| 322 script_(Script::Handle(zone(), script.raw())), | 322 script_(Script::Handle(zone(), script.raw())), |
| 323 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), | 323 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), |
| 324 token_pos), | 324 token_pos), |
| 325 token_kind_(Token::kILLEGAL), | 325 token_kind_(Token::kILLEGAL), |
| 326 current_block_(NULL), | 326 current_block_(NULL), |
| 327 is_top_level_(false), | 327 is_top_level_(false), |
| 328 await_is_keyword_(false), | 328 await_is_keyword_(false), |
| 329 current_member_(NULL), | 329 current_member_(NULL), |
| 330 allow_function_literals_(true), | 330 allow_function_literals_(true), |
| 331 parsed_function_(NULL), | 331 parsed_function_(NULL), |
| 332 innermost_function_(Function::Handle(zone())), | 332 innermost_function_(Function::Handle(zone())), |
| 333 literal_token_(LiteralToken::Handle(zone())), | 333 literal_token_(LiteralToken::Handle(zone())), |
| 334 current_class_(Class::Handle(zone())), | 334 current_class_(Class::Handle(zone())), |
| 335 library_(Library::Handle(zone(), library.raw())), | 335 library_(Library::Handle(zone(), library.raw())), |
| 336 try_stack_(NULL), | 336 try_stack_(NULL), |
| 337 last_used_try_index_(0), | 337 last_used_try_index_(0), |
| 338 unregister_pending_function_(false), | 338 unregister_pending_function_(false), |
| 339 async_temp_scope_(NULL), | 339 async_temp_scope_(NULL), |
| 340 trace_indent_(0) { | 340 trace_indent_(0) { |
| 341 ASSERT(tokens_iterator_.IsValid()); | 341 ASSERT(tokens_iterator_.IsValid()); |
| 342 ASSERT(!library.IsNull()); | 342 ASSERT(!library.IsNull()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 // For parsing a function. | 346 // For parsing a function. |
| 347 Parser::Parser(const Script& script, | 347 Parser::Parser(const Script& script, |
| 348 ParsedFunction* parsed_function, | 348 ParsedFunction* parsed_function, |
| 349 intptr_t token_position) | 349 intptr_t token_position) |
| 350 : thread_(Thread::Current()), | 350 : isolate_(Thread::Current()->isolate()), |
| 351 script_(Script::Handle(zone(), script.raw())), | 351 script_(Script::Handle(zone(), script.raw())), |
| 352 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), | 352 tokens_iterator_(TokenStream::Handle(zone(), script.tokens()), |
| 353 token_position), | 353 token_position), |
| 354 token_kind_(Token::kILLEGAL), | 354 token_kind_(Token::kILLEGAL), |
| 355 current_block_(NULL), | 355 current_block_(NULL), |
| 356 is_top_level_(false), | 356 is_top_level_(false), |
| 357 await_is_keyword_(false), | 357 await_is_keyword_(false), |
| 358 current_member_(NULL), | 358 current_member_(NULL), |
| 359 allow_function_literals_(true), | 359 allow_function_literals_(true), |
| 360 parsed_function_(parsed_function), | 360 parsed_function_(parsed_function), |
| (...skipping 13047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13408 void Parser::SkipQualIdent() { | 13408 void Parser::SkipQualIdent() { |
| 13409 ASSERT(IsIdentifier()); | 13409 ASSERT(IsIdentifier()); |
| 13410 ConsumeToken(); | 13410 ConsumeToken(); |
| 13411 if (CurrentToken() == Token::kPERIOD) { | 13411 if (CurrentToken() == Token::kPERIOD) { |
| 13412 ConsumeToken(); // Consume the kPERIOD token. | 13412 ConsumeToken(); // Consume the kPERIOD token. |
| 13413 ExpectIdentifier("identifier expected after '.'"); | 13413 ExpectIdentifier("identifier expected after '.'"); |
| 13414 } | 13414 } |
| 13415 } | 13415 } |
| 13416 | 13416 |
| 13417 } // namespace dart | 13417 } // namespace dart |
| OLD | NEW |