| 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/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 const Script& script) { | 386 const Script& script) { |
| 387 Isolate* isolate = Isolate::Current(); | 387 Isolate* isolate = Isolate::Current(); |
| 388 ASSERT(isolate->long_jump_base()->IsSafeToJump()); | 388 ASSERT(isolate->long_jump_base()->IsSafeToJump()); |
| 389 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer); | 389 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer); |
| 390 VMTagScope tagScope(isolate, VMTag::kCompileTopLevelTagId); | 390 VMTagScope tagScope(isolate, VMTag::kCompileTopLevelTagId); |
| 391 Parser parser(script, library, 0); | 391 Parser parser(script, library, 0); |
| 392 parser.ParseTopLevel(); | 392 parser.ParseTopLevel(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 Token::Kind Parser::CurrentToken() { | 396 void Parser::ComputeCurrentToken() { |
| 397 if (token_kind_ == Token::kILLEGAL) { | 397 ASSERT(token_kind_ == Token::kILLEGAL); |
| 398 token_kind_ = tokens_iterator_.CurrentTokenKind(); | 398 token_kind_ = tokens_iterator_.CurrentTokenKind(); |
| 399 if (token_kind_ == Token::kERROR) { | 399 if (token_kind_ == Token::kERROR) { |
| 400 ErrorMsg(TokenPos(), "%s", CurrentLiteral()->ToCString()); | 400 ErrorMsg(TokenPos(), "%s", CurrentLiteral()->ToCString()); |
| 401 } | |
| 402 } | 401 } |
| 403 CompilerStats::num_token_checks++; | |
| 404 return token_kind_; | |
| 405 } | 402 } |
| 406 | 403 |
| 407 | 404 |
| 408 Token::Kind Parser::LookaheadToken(int num_tokens) { | 405 Token::Kind Parser::LookaheadToken(int num_tokens) { |
| 409 CompilerStats::num_tokens_lookahead++; | 406 CompilerStats::num_tokens_lookahead++; |
| 410 CompilerStats::num_token_checks++; | 407 CompilerStats::num_token_checks++; |
| 411 return tokens_iterator_.LookaheadTokenKind(num_tokens); | 408 return tokens_iterator_.LookaheadTokenKind(num_tokens); |
| 412 } | 409 } |
| 413 | 410 |
| 414 | 411 |
| (...skipping 10611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11026 void Parser::SkipQualIdent() { | 11023 void Parser::SkipQualIdent() { |
| 11027 ASSERT(IsIdentifier()); | 11024 ASSERT(IsIdentifier()); |
| 11028 ConsumeToken(); | 11025 ConsumeToken(); |
| 11029 if (CurrentToken() == Token::kPERIOD) { | 11026 if (CurrentToken() == Token::kPERIOD) { |
| 11030 ConsumeToken(); // Consume the kPERIOD token. | 11027 ConsumeToken(); // Consume the kPERIOD token. |
| 11031 ExpectIdentifier("identifier expected after '.'"); | 11028 ExpectIdentifier("identifier expected after '.'"); |
| 11032 } | 11029 } |
| 11033 } | 11030 } |
| 11034 | 11031 |
| 11035 } // namespace dart | 11032 } // namespace dart |
| OLD | NEW |