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

Side by Side Diff: runtime/vm/object.cc

Issue 1810663002: Fail gracefully in Script::GetLine under precompilation like Script::GetSnippet. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8789 matching lines...) Expand 10 before | Expand all | Expand 10 after
8800 tkit.CurrentTokenKind() != Token::kEOS) { 8800 tkit.CurrentTokenKind() != Token::kEOS) {
8801 end_pos = tkit.CurrentPosition(); 8801 end_pos = tkit.CurrentPosition();
8802 tkit.Advance(); 8802 tkit.Advance();
8803 } 8803 }
8804 *last_token_index = end_pos; 8804 *last_token_index = end_pos;
8805 } 8805 }
8806 8806
8807 8807
8808 RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const { 8808 RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const {
8809 const String& src = String::Handle(Source()); 8809 const String& src = String::Handle(Source());
8810 if (src.IsNull()) {
8811 ASSERT(Dart::IsRunningPrecompiledCode());
8812 return Symbols::OptimizedOut().raw();
8813 }
8810 intptr_t relative_line_number = line_number - line_offset(); 8814 intptr_t relative_line_number = line_number - line_offset();
8811 intptr_t current_line = 1; 8815 intptr_t current_line = 1;
8812 intptr_t line_start_idx = -1; 8816 intptr_t line_start_idx = -1;
8813 intptr_t last_char_idx = -1; 8817 intptr_t last_char_idx = -1;
8814 for (intptr_t ix = 0; 8818 for (intptr_t ix = 0;
8815 (ix < src.Length()) && (current_line <= relative_line_number); 8819 (ix < src.Length()) && (current_line <= relative_line_number);
8816 ix++) { 8820 ix++) {
8817 if ((current_line == relative_line_number) && (line_start_idx < 0)) { 8821 if ((current_line == relative_line_number) && (line_start_idx < 0)) {
8818 line_start_idx = ix; 8822 line_start_idx = ix;
8819 } 8823 }
(...skipping 13097 matching lines...) Expand 10 before | Expand all | Expand 10 after
21917 return UserTag::null(); 21921 return UserTag::null();
21918 } 21922 }
21919 21923
21920 21924
21921 const char* UserTag::ToCString() const { 21925 const char* UserTag::ToCString() const {
21922 const String& tag_label = String::Handle(label()); 21926 const String& tag_label = String::Handle(label());
21923 return tag_label.ToCString(); 21927 return tag_label.ToCString();
21924 } 21928 }
21925 21929
21926 } // namespace dart 21930 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698