Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
dart::TokenPosition Class Reference

#include <token_position.h>

Public Member Functions

uword Hash () const
 
bool operator== (const TokenPosition &b) const
 
bool operator!= (const TokenPosition &b) const
 
bool operator< (const TokenPosition &b) const
 
bool operator> (const TokenPosition &b) const
 
bool operator<= (const TokenPosition &b) const
 
bool operator>= (const TokenPosition &b) const
 
bool IsWithin (const TokenPosition &a, const TokenPosition &b) const
 
 SENTINEL_TOKEN_DESCRIPTORS (DECLARE_VALUES)
 
int32_t Serialize () const
 
TokenPosition Next ()
 
intptr_t Pos () const
 
bool IsClassifying () const
 
bool IsNoSource () const
 
bool IsSynthetic () const
 
bool IsReal () const
 
bool IsDebugPause () const
 
intptr_t EncodeCoveragePosition (bool is_branch_coverage)
 
const char * ToCString () const
 

Static Public Member Functions

static const TokenPositionMin (const TokenPosition &a, const TokenPosition &b)
 
static const TokenPositionMax (const TokenPosition &a, const TokenPosition &b)
 
static intptr_t CompareForSorting (const TokenPosition &a, const TokenPosition &b)
 
static TokenPosition Deserialize (int32_t value)
 
static TokenPosition Synthetic (intptr_t value)
 
static TokenPosition DecodeCoveragePosition (intptr_t encoded_position, bool *is_branch_coverage)
 

Static Public Attributes

static constexpr int32_t kMaxSentinelDescriptors = 64
 
static constexpr int32_t kMinSourcePos = 0
 
static const TokenPosition kMinSource
 
static constexpr int32_t kMaxSourcePos
 
static const TokenPosition kMaxSource
 

Detailed Description

Definition at line 62 of file token_position.h.

Member Function Documentation

◆ CompareForSorting()

static intptr_t dart::TokenPosition::CompareForSorting ( const TokenPosition a,
const TokenPosition b 
)
inlinestatic

Definition at line 129 of file token_position.h.

130 {
131 return a.value() - b.value();
132 }
static bool b
struct MyStruct a[10]

◆ DecodeCoveragePosition()

TokenPosition dart::TokenPosition::DecodeCoveragePosition ( intptr_t  encoded_position,
bool *  is_branch_coverage 
)
static

Definition at line 31 of file token_position.cc.

32 {
33 *is_branch_coverage = ((encoded_position % 2) == 1);
34 return TokenPosition(encoded_position / 2);
35}

◆ Deserialize()

TokenPosition dart::TokenPosition::Deserialize ( int32_t  value)
static

Definition at line 16 of file token_position.cc.

16 {
17 return TokenPosition(value);
18}

◆ EncodeCoveragePosition()

intptr_t dart::TokenPosition::EncodeCoveragePosition ( bool  is_branch_coverage)

Definition at line 24 of file token_position.cc.

24 {
25 // Normal coverage positions are encoded as 2 * pos, and branch coverage are
26 // encoded as 2 * pos + 1.
27 intptr_t encoded_position = 2 * static_cast<intptr_t>(value_);
28 return is_branch_coverage ? encoded_position + 1 : encoded_position;
29}

◆ Hash()

uword dart::TokenPosition::Hash ( ) const

Definition at line 12 of file token_position.cc.

12 {
13 return Utils::WordHash(value_);
14}
static uint32_t WordHash(intptr_t key)
Definition: utils.cc:217

◆ IsClassifying()

bool dart::TokenPosition::IsClassifying ( ) const
inline

Definition at line 181 of file token_position.h.

181 {
182 return (value_ >= kBox.value()) && (value_ <= kLast.value());
183 }

◆ IsDebugPause()

bool dart::TokenPosition::IsDebugPause ( ) const
inline

Definition at line 197 of file token_position.h.

197{ return IsReal(); }

◆ IsNoSource()

bool dart::TokenPosition::IsNoSource ( ) const
inline

Definition at line 186 of file token_position.h.

186{ return value_ == kNoSourcePos; }

◆ IsReal()

bool dart::TokenPosition::IsReal ( ) const
inline

Definition at line 194 of file token_position.h.

194{ return value_ >= kMinSourcePos; }
static constexpr int32_t kMinSourcePos

◆ IsSynthetic()

bool dart::TokenPosition::IsSynthetic ( ) const
inline

Definition at line 191 of file token_position.h.

191{ return value_ < kLastPos; }

◆ IsWithin()

bool dart::TokenPosition::IsWithin ( const TokenPosition a,
const TokenPosition b 
) const
inline

Definition at line 99 of file token_position.h.

99 {
100 if (IsReal()) return (a.value() <= value()) && (value() <= b.value());
101 if (IsSynthetic()) return (a == *this) || (b == *this);
102 return false;
103 }
bool IsSynthetic() const

◆ Max()

static const TokenPosition & dart::TokenPosition::Max ( const TokenPosition a,
const TokenPosition b 
)
inlinestatic

Definition at line 115 of file token_position.h.

116 {
117 if (!b.IsReal()) return a;
118 if (!a.IsReal()) return b;
119 return b.value() > a.value() ? b : a;
120 }

◆ Min()

static const TokenPosition & dart::TokenPosition::Min ( const TokenPosition a,
const TokenPosition b 
)
inlinestatic

Definition at line 107 of file token_position.h.

108 {
109 if (!b.IsReal()) return a;
110 if (!a.IsReal()) return b;
111 return b.value() < a.value() ? b : a;
112 }

◆ Next()

TokenPosition dart::TokenPosition::Next ( )
inline

Definition at line 167 of file token_position.h.

167 {
168 ASSERT(IsReal());
169 return TokenPosition(value_ + 1);
170 }
#define ASSERT(E)

◆ operator!=()

bool dart::TokenPosition::operator!= ( const TokenPosition b) const
inline

Definition at line 72 of file token_position.h.

72{ return !(*this == b); }

◆ operator<()

bool dart::TokenPosition::operator< ( const TokenPosition b) const
inline

Definition at line 76 of file token_position.h.

76 {
77 return Pos() < b.Pos();
78 }
intptr_t Pos() const

◆ operator<=()

bool dart::TokenPosition::operator<= ( const TokenPosition b) const
inline

Definition at line 86 of file token_position.h.

86{ return !(*this > b); }

◆ operator==()

bool dart::TokenPosition::operator== ( const TokenPosition b) const
inline

Definition at line 68 of file token_position.h.

68{ return value() == b.value(); }

◆ operator>()

bool dart::TokenPosition::operator> ( const TokenPosition b) const
inline

Definition at line 82 of file token_position.h.

82{ return b < *this; }

◆ operator>=()

bool dart::TokenPosition::operator>= ( const TokenPosition b) const
inline

Definition at line 90 of file token_position.h.

90{ return !(*this < b); }

◆ Pos()

intptr_t dart::TokenPosition::Pos ( ) const
inline

Definition at line 173 of file token_position.h.

173 {
174 ASSERT(IsReal());
175 return value_;
176 }

◆ SENTINEL_TOKEN_DESCRIPTORS()

dart::TokenPosition::SENTINEL_TOKEN_DESCRIPTORS ( DECLARE_VALUES  )

◆ Serialize()

int32_t dart::TokenPosition::Serialize ( ) const

Definition at line 20 of file token_position.cc.

20 {
21 return static_cast<int32_t>(value_);
22}

◆ Synthetic()

static TokenPosition dart::TokenPosition::Synthetic ( intptr_t  value)
inlinestatic

Definition at line 200 of file token_position.h.

200 {
201 ASSERT(value >= 0 && value <= kMaxSourcePos);
202 return TokenPosition((kLastPos - 1) - value);
203 }
static constexpr int32_t kMaxSourcePos

◆ ToCString()

const char * dart::TokenPosition::ToCString ( ) const

Definition at line 44 of file token_position.cc.

44 {
45 switch (value_) {
46#define DEFINE_CASE(name, value) \
47 case value: \
48 return #name;
50#undef DEFINE_CASE
51 default:
52 break;
53 }
55 ZoneTextBuffer buffer(Thread::Current()->zone());
56 if (IsSynthetic()) {
57 buffer.AddString("syn:");
58 }
59 buffer.Printf("%" Pd32 "", value_);
60 return buffer.buffer();
61}
static Thread * Current()
Definition: thread.h:362
SENTINEL_TOKEN_DESCRIPTORS(DECLARE_VALUES)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
#define Pd32
Definition: globals.h:412
#define DEFINE_CASE(name, value)

Member Data Documentation

◆ kMaxSentinelDescriptors

constexpr int32_t dart::TokenPosition::kMaxSentinelDescriptors = 64
staticconstexpr

Definition at line 134 of file token_position.h.

◆ kMaxSource

const TokenPosition dart::TokenPosition::kMaxSource
static

Definition at line 158 of file token_position.h.

◆ kMaxSourcePos

constexpr int32_t dart::TokenPosition::kMaxSourcePos
staticconstexpr
Initial value:
=
static constexpr int32_t kMaxSentinelDescriptors
const intptr_t kSmiMax32
Definition: globals.h:33

Definition at line 156 of file token_position.h.

◆ kMinSource

const TokenPosition dart::TokenPosition::kMinSource
static

Definition at line 155 of file token_position.h.

◆ kMinSourcePos

constexpr int32_t dart::TokenPosition::kMinSourcePos = 0
staticconstexpr

Definition at line 154 of file token_position.h.


The documentation for this class was generated from the following files: