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

Unified Diff: runtime/vm/object.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/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
===================================================================
--- runtime/vm/object.cc (revision 9175)
+++ runtime/vm/object.cc (working copy)
@@ -4528,11 +4528,13 @@
}
-intptr_t Script::TokenIndexAtLine(intptr_t line_number) const {
+void Script::TokenRangeAtLine(intptr_t line_number,
+ intptr_t* first_token_index,
+ intptr_t* last_token_index) const {
const String& src = String::Handle(source());
const String& dummy_key = String::Handle(String::New(""));
Scanner scanner(src, dummy_key);
- return scanner.TokenIndexAtLine(line_number);
+ scanner.TokenRangeAtLine(line_number, first_token_index, last_token_index);
}
@@ -4694,7 +4696,7 @@
LibraryPrefixIterator::LibraryPrefixIterator(const Library& library)
: DictionaryIterator(library) {
- MoveToNext();
+ Advance();
}
@@ -4702,14 +4704,14 @@
ASSERT(HasNext());
int ix = next_ix_++;
Object& obj = Object::Handle(array_.At(ix));
- MoveToNext();
+ Advance();
LibraryPrefix& prefix = LibraryPrefix::Handle();
prefix ^= obj.raw();
return prefix.raw();
}
-void LibraryPrefixIterator::MoveToNext() {
+void LibraryPrefixIterator::Advance() {
Object& obj = Object::Handle(array_.At(next_ix_));
while (!obj.IsLibraryPrefix() && HasNext()) {
next_ix_++;
@@ -4926,13 +4928,13 @@
}
// Determine token position at given line number.
- intptr_t token_pos_at_line = script.TokenIndexAtLine(line_number);
- if (token_pos_at_line < 0) {
+ intptr_t first_token_pos, last_token_pos;
+ script.TokenRangeAtLine(line_number, &first_token_pos, &last_token_pos);
+ if (first_token_pos < 0) {
// Script does not contain the given line number.
return Function::null();
}
-
- return LookupFunctionInScript(script, token_pos_at_line);
+ return LookupFunctionInScript(script, first_token_pos);
}
« 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