static_assert(k##
name##Pos < 0,
"Non-negative sentinel descriptor"); \
static_assert( \
k##
name##Pos == kNoSourcePos || k##
name##Pos <= kBoxPos, \
"Box sentinel descriptor is not greatest classifying sentinel value"); \
static_assert(kLastPos <= k##
name##Pos, \
"Last sentinel descriptor is not least sentinel valu"); \
#define CHECK_VALUES(name, value)
167 {
169 return TokenPosition(value_ + 1);
170 }
171
172
173 inline intptr_t Pos() const {
175 return value_;
176 }
177
178
179
180
181 inline bool IsClassifying() const {
182 return (value_ >= kBox.value()) && (value_ <=
kLast.value());
183 }
184
185
186 inline bool IsNoSource() const { return value_ == kNoSourcePos; }
187
188
189
190
191 inline bool IsSynthetic() const { return value_ < kLastPos; }
192
193
194 inline bool IsReal() const { return value_ >= kMinSourcePos; }
195
196
197 inline bool IsDebugPause() const { return IsReal(); }
198
199
200 static TokenPosition Synthetic(intptr_t value) {
201 ASSERT(value >= 0 && value <= kMaxSourcePos);
202 return TokenPosition((kLastPos - 1) - value);
203 }
204
205
206 intptr_t EncodeCoveragePosition(bool is_branch_coverage);
207
208
209 static TokenPosition DecodeCoveragePosition(intptr_t encoded_position,
210 bool* is_branch_coverage);
211
212 const char* ToCString() const;
213
214 private:
215 explicit TokenPosition(intptr_t value) : value_(
value) {}
216
217
218 intptr_t
value()
const {
return value_; }
219
220 int32_t value_;
221
223};
224
225}
226
227#endif