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

Unified Diff: runtime/vm/scanner.cc

Issue 10686003: Better breakpoint placement (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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/scanner.h ('k') | runtime/vm/scanner_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.cc
===================================================================
--- runtime/vm/scanner.cc (revision 9175)
+++ runtime/vm/scanner.cc (working copy)
@@ -874,22 +874,41 @@
}
-intptr_t Scanner::TokenIndexAtLine(intptr_t line_number) {
+void Scanner::TokenRangeAtLine(intptr_t line_number,
+ intptr_t* first_token_index,
+ intptr_t* last_token_index) {
ASSERT(line_number >= 0);
+ ASSERT((first_token_index != NULL) && (last_token_index != NULL));
Reset();
+ *first_token_index = -1;
+ *last_token_index = -1;
int token_index = 0;
do {
Scan();
if (current_token_.position.line >= line_number) {
- return token_index;
+ *first_token_index = token_index;
+ break;
}
token_index++;
} while (current_token_.kind != Token::kEOS);
- return -1;
+ if (current_token_.kind == Token::kEOS) {
+ return;
+ }
+ if (current_token_.position.line > line_number) {
+ // *last_token_index is -1 to signal that the first token is past
+ // the requested line.
+ return;
+ }
+ ASSERT(current_token_.position.line == line_number);
+ while ((current_token_.kind != Token::kEOS) &&
+ (current_token_.position.line == line_number)) {
+ *last_token_index = token_index;
+ Scan();
+ token_index++;
+ }
}
-
const Scanner::GrowableTokenStream& Scanner::GetStream() {
GrowableTokenStream* ts = new GrowableTokenStream(128);
ScanAll(ts);
« no previous file with comments | « runtime/vm/scanner.h ('k') | runtime/vm/scanner_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698