#include <kernel.h>
Definition at line 130 of file kernel.h.
◆ KernelLineStartsReader()
Definition at line 21 of file kernel.cc.
24 : line_starts_data_(line_starts_data) {
26 if (
type == kUint16ArrayElement) {
27 helper_ = new KernelUint16LineStartsHelper();
28 }
else if (
type == kUint32ArrayElement) {
29 helper_ = new KernelUint32LineStartsHelper();
30 } else {
32 }
33}
TypedDataElementType ElementType() const
◆ ~KernelLineStartsReader()
dart::kernel::KernelLineStartsReader::~KernelLineStartsReader |
( |
| ) |
|
|
inline |
◆ At()
uint32_t dart::kernel::KernelLineStartsReader::At |
( |
intptr_t |
index | ) |
const |
|
inline |
Definition at line 137 of file kernel.h.
137 {
138 return helper_->At(line_starts_data_, index);
139 }
◆ LocationForPosition()
bool dart::kernel::KernelLineStartsReader::LocationForPosition |
( |
intptr_t |
position, |
|
|
intptr_t * |
line, |
|
|
intptr_t * |
col = nullptr |
|
) |
| const |
Definition at line 43 of file kernel.cc.
45 {
46 const intptr_t line_count = line_starts_data_.
Length();
47 if (position < 0 ||
static_cast<uint32_t
>(position) >
MaxPosition() ||
48 line_count == 0) {
49 return false;
50 }
51
52 intptr_t lo = 0;
53 intptr_t hi = line_count;
54 while (hi > lo + 1) {
55 const intptr_t mid = lo + (hi - lo) / 2;
56 const intptr_t mid_position = helper_->At(line_starts_data_, mid);
57 if (mid_position > position) {
58 hi = mid;
59 } else {
60 lo = mid;
61 }
62 }
64 if (col != nullptr) {
65 *col = position - helper_->At(line_starts_data_, lo) + 1;
66 }
67
68 return true;
69}
uint32_t MaxPosition() const
◆ MaxPosition()
uint32_t dart::kernel::KernelLineStartsReader::MaxPosition |
( |
| ) |
const |
Definition at line 35 of file kernel.cc.
35 {
36 const intptr_t line_count = line_starts_data_.
Length();
37 if (line_count == 0) {
38 return 0;
39 }
40 return helper_->At(line_starts_data_, line_count - 1);
41}
◆ TokenRangeAtLine()
Definition at line 71 of file kernel.cc.
74 {
75 const intptr_t line_count = line_starts_data_.
Length();
76 if (line_number <= 0 || line_number > line_count) {
77 return false;
78 }
80 helper_->At(line_starts_data_, line_number - 1));
81 if (line_number == line_count) {
82 *last_token_index = *first_token_index;
83 } else {
85 helper_->At(line_starts_data_, line_number) - 1);
86 }
87 return true;
88}
static TokenPosition Deserialize(int32_t value)
The documentation for this class was generated from the following files:
- third_party/dart-lang/sdk/runtime/vm/kernel.h
- third_party/dart-lang/sdk/runtime/vm/kernel.cc