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

Unified Diff: runtime/vm/object.cc

Issue 1968143002: Small fix in Scanner (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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.h ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 60e35500e4ab80adfbce2746a66d2f1e9fb84e4a..eff85d59347820e2aa68abc2ccae429e2a7ccf24 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -8373,19 +8373,18 @@ RawString* TokenStream::GenerateSource(TokenPosition start_pos,
}
-TokenPosition TokenStream::ComputeSourcePosition(
- TokenPosition tok_pos) const {
+intptr_t TokenStream::ComputeSourcePosition(TokenPosition tok_pos) const {
Zone* zone = Thread::Current()->zone();
Iterator iterator(zone,
*this,
TokenPosition::kMinSource,
Iterator::kAllTokens);
- TokenPosition src_pos = TokenPosition::kMinSource;
+ intptr_t src_pos = 0;
Token::Kind kind = iterator.CurrentTokenKind();
while ((iterator.CurrentPosition() < tok_pos) && (kind != Token::kEOS)) {
iterator.Advance();
kind = iterator.CurrentTokenKind();
- src_pos.Next();
+ src_pos++;
}
return src_pos;
}
@@ -8994,7 +8993,7 @@ void Script::GetTokenLocation(TokenPosition token_pos,
*line = cur_line;
} else {
const String& src = String::Handle(zone, Source());
- TokenPosition src_pos = tkns.ComputeSourcePosition(token_pos);
+ intptr_t src_pos = tkns.ComputeSourcePosition(token_pos);
Scanner scanner(src, Symbols::Empty());
scanner.ScanTo(src_pos);
intptr_t relative_line = scanner.CurrentPosition().line;
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698