| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 8409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8420 intptr_t line = 1 + line_offset(); | 8420 intptr_t line = 1 + line_offset(); |
| 8421 intptr_t column = 1; | 8421 intptr_t column = 1; |
| 8422 intptr_t scan_position = 0; | 8422 intptr_t scan_position = 0; |
| 8423 intptr_t snippet_start = -1; | 8423 intptr_t snippet_start = -1; |
| 8424 intptr_t snippet_end = -1; | 8424 intptr_t snippet_end = -1; |
| 8425 if (from_line - line_offset() == 1) { | 8425 if (from_line - line_offset() == 1) { |
| 8426 column += col_offset(); | 8426 column += col_offset(); |
| 8427 } | 8427 } |
| 8428 | 8428 |
| 8429 while (scan_position != length) { | 8429 while (scan_position != length) { |
| 8430 if (snippet_start == -1) { |
| 8431 if ((line == from_line) && (column == from_column)) { |
| 8432 snippet_start = scan_position; |
| 8433 } |
| 8434 } |
| 8435 |
| 8430 char c = src.CharAt(scan_position); | 8436 char c = src.CharAt(scan_position); |
| 8431 if (c == '\n') { | 8437 if (c == '\n') { |
| 8432 line++; | 8438 line++; |
| 8433 column = 0; | 8439 column = 0; |
| 8434 } else if (c == '\r') { | 8440 } else if (c == '\r') { |
| 8435 line++; | 8441 line++; |
| 8436 column = 0; | 8442 column = 0; |
| 8437 if ((scan_position + 1 != length) && | 8443 if ((scan_position + 1 != length) && |
| 8438 (src.CharAt(scan_position + 1) == '\n')) { | 8444 (src.CharAt(scan_position + 1) == '\n')) { |
| 8439 scan_position++; | 8445 scan_position++; |
| 8440 } | 8446 } |
| 8441 } | 8447 } |
| 8442 scan_position++; | 8448 scan_position++; |
| 8443 column++; | 8449 column++; |
| 8444 | 8450 |
| 8445 if (snippet_start == -1) { | 8451 if ((line == to_line) && (column == to_column)) { |
| 8446 if ((line == from_line) && (column == from_column)) { | |
| 8447 snippet_start = scan_position; | |
| 8448 } | |
| 8449 } else if ((line == to_line) && (column == to_column)) { | |
| 8450 snippet_end = scan_position; | 8452 snippet_end = scan_position; |
| 8451 break; | 8453 break; |
| 8452 } | 8454 } |
| 8453 } | 8455 } |
| 8454 String& snippet = String::Handle(); | 8456 String& snippet = String::Handle(); |
| 8455 if ((snippet_start != -1) && (snippet_end != -1)) { | 8457 if ((snippet_start != -1) && (snippet_end != -1)) { |
| 8456 snippet = | 8458 snippet = |
| 8457 String::SubString(src, snippet_start, snippet_end - snippet_start); | 8459 String::SubString(src, snippet_start, snippet_end - snippet_start); |
| 8458 } | 8460 } |
| 8459 return snippet.raw(); | 8461 return snippet.raw(); |
| (...skipping 12265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20725 return tag_label.ToCString(); | 20727 return tag_label.ToCString(); |
| 20726 } | 20728 } |
| 20727 | 20729 |
| 20728 | 20730 |
| 20729 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20731 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20730 Instance::PrintJSONImpl(stream, ref); | 20732 Instance::PrintJSONImpl(stream, ref); |
| 20731 } | 20733 } |
| 20732 | 20734 |
| 20733 | 20735 |
| 20734 } // namespace dart | 20736 } // namespace dart |
| OLD | NEW |