Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: runtime/vm/parser.h

Issue 1574213005: Report missing semicolons after function declarations (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.h
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index 1be0f50598e4b60b05903ef2030e691d5a0a61bb..edc8fdfd01d88936f8e608bcffc5d97cf73729b1 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -294,6 +294,7 @@ class Parser : public ValueObject {
}
intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); }
+ intptr_t PrevTokenPos() const { return prev_token_pos_; }
Token::Kind CurrentToken() {
if (token_kind_ == Token::kILLEGAL) {
@@ -316,6 +317,7 @@ class Parser : public ValueObject {
void ConsumeToken() {
// Reset cache and advance the token.
+ prev_token_pos_ = tokens_iterator_.CurrentPosition();
token_kind_ = Token::kILLEGAL;
tokens_iterator_.Advance();
INC_STAT(thread(), num_tokens_consumed, 1);
@@ -374,6 +376,8 @@ class Parser : public ValueObject {
// Report error message at location of current token in current script.
void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3);
+ void ReportErrorBefore(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
+
// Report error message at given location in current script.
void ReportError(intptr_t token_pos,
const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4);
@@ -533,7 +537,7 @@ class Parser : public ValueObject {
void AddFormalParamsToScope(const ParamList* params, LocalScope* scope);
SequenceNode* ParseConstructor(const Function& func);
- SequenceNode* ParseFunc(const Function& func);
+ SequenceNode* ParseFunc(const Function& func, bool check_semicolon);
void ParseNativeFunctionBlock(const ParamList* params, const Function& func);
@@ -833,6 +837,7 @@ class Parser : public ValueObject {
Script& script_;
TokenStream::Iterator tokens_iterator_;
Token::Kind token_kind_; // Cached token kind for current token.
+ intptr_t prev_token_pos_;
Block* current_block_;
// is_top_level_ is true if parsing the "top level" of a compilation unit,
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698