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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 return current_class_; | 436 return current_class_; |
437 } | 437 } |
438 | 438 |
439 | 439 |
440 void Parser::set_current_class(const Class& value) { | 440 void Parser::set_current_class(const Class& value) { |
441 current_class_ = value.raw(); | 441 current_class_ = value.raw(); |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 void Parser::SetPosition(intptr_t position) { | 445 void Parser::SetPosition(intptr_t position) { |
446 if (position < TokenPos() && position != 0) { | |
447 INC_STAT(I, num_tokens_rewind, (TokenPos() - position)); | |
448 } | |
449 tokens_iterator_.SetCurrentPosition(position); | 446 tokens_iterator_.SetCurrentPosition(position); |
450 token_kind_ = Token::kILLEGAL; | 447 token_kind_ = Token::kILLEGAL; |
451 } | 448 } |
452 | 449 |
453 | 450 |
454 void Parser::ParseCompilationUnit(const Library& library, | 451 void Parser::ParseCompilationUnit(const Library& library, |
455 const Script& script) { | 452 const Script& script) { |
456 Isolate* isolate = Isolate::Current(); | 453 Isolate* isolate = Isolate::Current(); |
457 ASSERT(isolate->long_jump_base()->IsSafeToJump()); | 454 ASSERT(isolate->long_jump_base()->IsSafeToJump()); |
458 CSTAT_TIMER_SCOPE(isolate, parser_timer); | 455 CSTAT_TIMER_SCOPE(isolate, parser_timer); |
(...skipping 13019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13478 void Parser::SkipQualIdent() { | 13475 void Parser::SkipQualIdent() { |
13479 ASSERT(IsIdentifier()); | 13476 ASSERT(IsIdentifier()); |
13480 ConsumeToken(); | 13477 ConsumeToken(); |
13481 if (CurrentToken() == Token::kPERIOD) { | 13478 if (CurrentToken() == Token::kPERIOD) { |
13482 ConsumeToken(); // Consume the kPERIOD token. | 13479 ConsumeToken(); // Consume the kPERIOD token. |
13483 ExpectIdentifier("identifier expected after '.'"); | 13480 ExpectIdentifier("identifier expected after '.'"); |
13484 } | 13481 } |
13485 } | 13482 } |
13486 | 13483 |
13487 } // namespace dart | 13484 } // namespace dart |
OLD | NEW |