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

Unified Diff: runtime/vm/object.cc

Issue 1066203004: Fix MethodMirror.source when the method is on the first line in a script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « no previous file | tests/lib/mirrors/method_mirror_source_other.dart » ('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 0fda4e48c5fdea78e20feddb11eb607bde8ba93b..a1a536c8f721bb9460f4d1af4f4f65cd2d2b956f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -8427,6 +8427,12 @@ RawString* Script::GetSnippet(intptr_t from_line,
}
while (scan_position != length) {
+ if (snippet_start == -1) {
+ if ((line == from_line) && (column == from_column)) {
+ snippet_start = scan_position;
+ }
+ }
+
char c = src.CharAt(scan_position);
if (c == '\n') {
line++;
@@ -8442,11 +8448,7 @@ RawString* Script::GetSnippet(intptr_t from_line,
scan_position++;
column++;
- if (snippet_start == -1) {
- if ((line == from_line) && (column == from_column)) {
- snippet_start = scan_position;
- }
- } else if ((line == to_line) && (column == to_column)) {
+ if ((line == to_line) && (column == to_column)) {
snippet_end = scan_position;
break;
}
« no previous file with comments | « no previous file | tests/lib/mirrors/method_mirror_source_other.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698