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

#include <scopes.h>

Inheritance diagram for dart::LocalVariable:
dart::ZoneAllocated

Public Types

enum  TypeCheckMode { kDoTypeCheck , kSkipTypeCheck , kTypeCheckedByCaller }
 

Public Member Functions

 LocalVariable (TokenPosition declaration_pos, TokenPosition token_pos, const String &name, const AbstractType &static_type, intptr_t kernel_offset=kNoKernelOffset)
 
 LocalVariable (TokenPosition declaration_pos, TokenPosition token_pos, const String &name, const AbstractType &static_type, intptr_t kernel_offset, CompileType *inferred_type, CompileType *inferred_arg_type=nullptr, const Object *inferred_arg_value=nullptr)
 
TokenPosition token_pos () const
 
TokenPosition declaration_token_pos () const
 
const Stringname () const
 
intptr_t kernel_offset () const
 
intptr_t annotations_offset () const
 
LocalScopeowner () const
 
void set_owner (LocalScope *owner)
 
void set_annotations_offset (intptr_t offset)
 
const AbstractTypestatic_type () const
 
CompileTypeinferred_type () const
 
CompileTypeinferred_arg_type () const
 
const Objectinferred_arg_value () const
 
bool is_final () const
 
void set_is_final ()
 
bool is_captured () const
 
void set_is_captured ()
 
bool ComputeIfIsAwaiterLink (const Library &library)
 
void set_is_awaiter_link (bool value)
 
bool is_forced_stack () const
 
void set_is_forced_stack ()
 
bool is_late () const
 
void set_is_late ()
 
intptr_t late_init_offset () const
 
void set_late_init_offset (intptr_t late_init_offset)
 
bool is_explicit_covariant_parameter () const
 
void set_is_explicit_covariant_parameter ()
 
bool needs_covariant_check_in_method () const
 
void set_needs_covariant_check_in_method ()
 
bool needs_type_check () const
 
bool was_type_checked_by_caller () const
 
TypeCheckMode type_check_mode () const
 
void set_type_check_mode (TypeCheckMode mode)
 
bool HasIndex () const
 
VariableIndex index () const
 
void set_index (VariableIndex index)
 
bool is_invisible () const
 
void set_invisible (bool value)
 
bool is_captured_parameter () const
 
void set_is_captured_parameter (bool value)
 
bool Equals (const LocalVariable &other) const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Attributes

static constexpr intptr_t kNoKernelOffset = -1
 

Friends

class LocalScope
 

Detailed Description

Definition at line 75 of file scopes.h.

Member Enumeration Documentation

◆ TypeCheckMode

Enumerator
kDoTypeCheck 
kSkipTypeCheck 
kTypeCheckedByCaller 

Definition at line 182 of file scopes.h.

Constructor & Destructor Documentation

◆ LocalVariable() [1/2]

dart::LocalVariable::LocalVariable ( TokenPosition  declaration_pos,
TokenPosition  token_pos,
const String name,
const AbstractType static_type,
intptr_t  kernel_offset = kNoKernelOffset 
)

Definition at line 224 of file scopes.cc.

229 : LocalVariable(declaration_pos,
230 token_pos,
231 name,
234 new CompileType(CompileType::FromAbstractType(
static constexpr bool kCannotBeSentinel
Definition: compile_type.h:49
static constexpr bool kCanBeNull
Definition: compile_type.h:45
static CompileType FromAbstractType(const AbstractType &type, bool can_be_null, bool can_be_sentinel)
TokenPosition token_pos() const
Definition: scopes.h:117
const AbstractType & static_type() const
Definition: scopes.h:134
intptr_t kernel_offset() const
Definition: scopes.h:120
const String & name() const
Definition: scopes.h:119
LocalVariable(TokenPosition declaration_pos, TokenPosition token_pos, const String &name, const AbstractType &static_type, intptr_t kernel_offset=kNoKernelOffset)
Definition: scopes.cc:224

◆ LocalVariable() [2/2]

dart::LocalVariable::LocalVariable ( TokenPosition  declaration_pos,
TokenPosition  token_pos,
const String name,
const AbstractType static_type,
intptr_t  kernel_offset,
CompileType inferred_type,
CompileType inferred_arg_type = nullptr,
const Object inferred_arg_value = nullptr 
)
inline

Definition at line 85 of file scopes.h.

93 : declaration_pos_(declaration_pos),
94 token_pos_(token_pos),
95 name_(name),
96 kernel_offset_(kernel_offset),
97 annotations_offset_(kNoKernelOffset),
98 owner_(nullptr),
99 static_type_(static_type),
100 inferred_type_(inferred_type),
101 inferred_arg_type_(inferred_arg_type),
102 inferred_arg_value_(inferred_arg_value),
103 covariance_mode_(kNotCovariant),
104 late_init_offset_(0),
105 type_check_mode_(kDoTypeCheck),
106 index_(),
107 is_awaiter_link_(IsAwaiterLink::kNotLink) {
108 DEBUG_ASSERT(static_type.IsNotTemporaryScopedHandle());
110 ASSERT(inferred_type != nullptr);
112 if (IsFilteredIdentifier(name)) {
113 set_invisible(true);
114 }
115 }
#define DEBUG_ASSERT(cond)
Definition: assert.h:321
bool IsFinalized() const
Definition: object.h:9053
CompileType * inferred_type() const
Definition: scopes.h:136
void set_invisible(bool value)
Definition: scopes.h:216
const Object * inferred_arg_value() const
Definition: scopes.h:138
static constexpr intptr_t kNoKernelOffset
Definition: scopes.h:77
CompileType * inferred_arg_type() const
Definition: scopes.h:137
bool IsSymbol() const
Definition: object.h:10309
#define ASSERT(E)

Member Function Documentation

◆ annotations_offset()

intptr_t dart::LocalVariable::annotations_offset ( ) const
inline

Definition at line 121 of file scopes.h.

121{ return annotations_offset_; }

◆ ComputeIfIsAwaiterLink()

bool dart::LocalVariable::ComputeIfIsAwaiterLink ( const Library library)

Definition at line 603 of file scopes.cc.

603 {
604 if (is_awaiter_link_ == IsAwaiterLink::kUnknown) {
605 RELEASE_ASSERT(annotations_offset_ != kNoKernelOffset);
606 Thread* T = Thread::Current();
607 Zone* Z = T->zone();
608 const auto& metadata = Object::Handle(
609 Z, kernel::EvaluateMetadata(library, annotations_offset_,
610 /* is_annotations_offset = */ true));
612 FindPragmaInMetadata(T, metadata, Symbols::vm_awaiter_link()));
613 }
614 return is_awaiter_link_ == IsAwaiterLink::kLink;
615}
#define RELEASE_ASSERT(cond)
Definition: assert.h:327
#define Z
void set_is_awaiter_link(bool value)
Definition: scopes.h:147
static Object & Handle()
Definition: object.h:407
static Thread * Current()
Definition: thread.h:362
ObjectPtr EvaluateMetadata(const Library &library, intptr_t kernel_offset, bool is_annotations_offset)
Definition: kernel.cc:467
bool FindPragmaInMetadata(Thread *T, const Object &metadata_obj, const String &pragma_name, bool multiple, Object *options)
Definition: object.cc:4092
#define T
Definition: precompiler.cc:65

◆ declaration_token_pos()

TokenPosition dart::LocalVariable::declaration_token_pos ( ) const
inline

Definition at line 118 of file scopes.h.

118{ return declaration_pos_; }

◆ Equals()

bool dart::LocalVariable::Equals ( const LocalVariable other) const

Definition at line 617 of file scopes.cc.

617 {
618 if (HasIndex() && other.HasIndex() && (index() == other.index())) {
619 if (is_captured() == other.is_captured()) {
620 if (!is_captured()) {
621 return true;
622 }
623 if (owner()->context_level() == other.owner()->context_level()) {
624 return true;
625 }
626 }
627 }
628 return false;
629}
int context_level() const
Definition: scopes.h:333
VariableIndex index() const
Definition: scopes.h:202
LocalScope * owner() const
Definition: scopes.h:122
bool HasIndex() const
Definition: scopes.h:201
bool is_captured() const
Definition: scopes.h:143

◆ HasIndex()

bool dart::LocalVariable::HasIndex ( ) const
inline

Definition at line 201 of file scopes.h.

201{ return index_.IsValid(); }
bool IsValid() const
Definition: scopes.h:67

◆ index()

VariableIndex dart::LocalVariable::index ( ) const
inline

Definition at line 202 of file scopes.h.

202 {
203 ASSERT(HasIndex());
204 return index_;
205 }

◆ inferred_arg_type()

CompileType * dart::LocalVariable::inferred_arg_type ( ) const
inline

Definition at line 137 of file scopes.h.

137{ return inferred_arg_type_; }

◆ inferred_arg_value()

const Object * dart::LocalVariable::inferred_arg_value ( ) const
inline

Definition at line 138 of file scopes.h.

138{ return inferred_arg_value_; }

◆ inferred_type()

CompileType * dart::LocalVariable::inferred_type ( ) const
inline

Definition at line 136 of file scopes.h.

136{ return inferred_type_; }

◆ is_captured()

bool dart::LocalVariable::is_captured ( ) const
inline

Definition at line 143 of file scopes.h.

143{ return IsCapturedBit::decode(bitfield_); }
static constexpr T decode(S value)
Definition: bitfield.h:171

◆ is_captured_parameter()

bool dart::LocalVariable::is_captured_parameter ( ) const
inline

Definition at line 220 of file scopes.h.

220 {
221 return IsCapturedParameterBit::decode(bitfield_);
222 }

◆ is_explicit_covariant_parameter()

bool dart::LocalVariable::is_explicit_covariant_parameter ( ) const
inline

Definition at line 168 of file scopes.h.

168 {
169 return covariance_mode_ == kExplicit;
170 }

◆ is_final()

bool dart::LocalVariable::is_final ( ) const
inline

Definition at line 140 of file scopes.h.

140{ return IsFinalBit::decode(bitfield_); }

◆ is_forced_stack()

bool dart::LocalVariable::is_forced_stack ( ) const
inline

Definition at line 155 of file scopes.h.

155{ return IsForcedStackBit::decode(bitfield_); }

◆ is_invisible()

bool dart::LocalVariable::is_invisible ( ) const
inline

Definition at line 215 of file scopes.h.

215{ return IsInvisibleBit::decode(bitfield_); }

◆ is_late()

bool dart::LocalVariable::is_late ( ) const
inline

Definition at line 160 of file scopes.h.

160{ return IsLateBit::decode(bitfield_); }

◆ kernel_offset()

intptr_t dart::LocalVariable::kernel_offset ( ) const
inline

Definition at line 120 of file scopes.h.

120{ return kernel_offset_; }

◆ late_init_offset()

intptr_t dart::LocalVariable::late_init_offset ( ) const
inline

Definition at line 163 of file scopes.h.

163{ return late_init_offset_; }

◆ name()

const String & dart::LocalVariable::name ( ) const
inline

Definition at line 119 of file scopes.h.

119{ return name_; }

◆ needs_covariant_check_in_method()

bool dart::LocalVariable::needs_covariant_check_in_method ( ) const
inline

Definition at line 173 of file scopes.h.

173 {
174 return covariance_mode_ != kNotCovariant;
175 }

◆ needs_type_check()

bool dart::LocalVariable::needs_type_check ( ) const
inline

Definition at line 190 of file scopes.h.

190{ return (type_check_mode_ == kDoTypeCheck); }

◆ owner()

LocalScope * dart::LocalVariable::owner ( ) const
inline

Definition at line 122 of file scopes.h.

122{ return owner_; }

◆ set_annotations_offset()

void dart::LocalVariable::set_annotations_offset ( intptr_t  offset)
inline

Definition at line 128 of file scopes.h.

128 {
129 annotations_offset_ = offset;
130 is_awaiter_link_ = (offset == kNoKernelOffset) ? IsAwaiterLink::kNotLink
131 : IsAwaiterLink::kUnknown;
132 }
SeparatedVector2 offset

◆ set_index()

void dart::LocalVariable::set_index ( VariableIndex  index)
inline

Definition at line 208 of file scopes.h.

208 {
210 index_ = index;
211 }

◆ set_invisible()

void dart::LocalVariable::set_invisible ( bool  value)
inline

Definition at line 216 of file scopes.h.

216 {
217 bitfield_ = IsInvisibleBit::update(value, bitfield_);
218 }
static constexpr S update(T value, S original)
Definition: bitfield.h:188
uint8_t value

◆ set_is_awaiter_link()

void dart::LocalVariable::set_is_awaiter_link ( bool  value)
inline

Definition at line 147 of file scopes.h.

147 {
148 is_awaiter_link_ = value ? IsAwaiterLink::kLink : IsAwaiterLink::kNotLink;
149 }

◆ set_is_captured()

void dart::LocalVariable::set_is_captured ( )
inline

Definition at line 144 of file scopes.h.

144{ bitfield_ = IsCapturedBit::update(true, bitfield_); }

◆ set_is_captured_parameter()

void dart::LocalVariable::set_is_captured_parameter ( bool  value)
inline

Definition at line 223 of file scopes.h.

223 {
224 bitfield_ = IsCapturedParameterBit::update(value, bitfield_);
225 }

◆ set_is_explicit_covariant_parameter()

void dart::LocalVariable::set_is_explicit_covariant_parameter ( )
inline

Definition at line 171 of file scopes.h.

171{ covariance_mode_ = kExplicit; }

◆ set_is_final()

void dart::LocalVariable::set_is_final ( )
inline

Definition at line 141 of file scopes.h.

141{ bitfield_ = IsFinalBit::update(true, bitfield_); }

◆ set_is_forced_stack()

void dart::LocalVariable::set_is_forced_stack ( )
inline

Definition at line 156 of file scopes.h.

156 {
157 bitfield_ = IsForcedStackBit::update(true, bitfield_);
158 }

◆ set_is_late()

void dart::LocalVariable::set_is_late ( )
inline

Definition at line 161 of file scopes.h.

161{ bitfield_ = IsLateBit::update(true, bitfield_); }

◆ set_late_init_offset()

void dart::LocalVariable::set_late_init_offset ( intptr_t  late_init_offset)
inline

Definition at line 164 of file scopes.h.

164 {
165 late_init_offset_ = late_init_offset;
166 }
intptr_t late_init_offset() const
Definition: scopes.h:163

◆ set_needs_covariant_check_in_method()

void dart::LocalVariable::set_needs_covariant_check_in_method ( )
inline

Definition at line 176 of file scopes.h.

176 {
177 if (covariance_mode_ == kNotCovariant) {
178 covariance_mode_ = kImplicit;
179 }
180 }

◆ set_owner()

void dart::LocalVariable::set_owner ( LocalScope owner)
inline

Definition at line 123 of file scopes.h.

123 {
124 ASSERT(owner_ == nullptr);
125 owner_ = owner;
126 }

◆ set_type_check_mode()

void dart::LocalVariable::set_type_check_mode ( TypeCheckMode  mode)
inline

Definition at line 199 of file scopes.h.

199{ type_check_mode_ = mode; }
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ static_type()

const AbstractType & dart::LocalVariable::static_type ( ) const
inline

Definition at line 134 of file scopes.h.

134{ return static_type_; }

◆ token_pos()

TokenPosition dart::LocalVariable::token_pos ( ) const
inline

Definition at line 117 of file scopes.h.

117{ return token_pos_; }

◆ type_check_mode()

TypeCheckMode dart::LocalVariable::type_check_mode ( ) const
inline

Definition at line 198 of file scopes.h.

198{ return type_check_mode_; }

◆ was_type_checked_by_caller()

bool dart::LocalVariable::was_type_checked_by_caller ( ) const
inline

Definition at line 194 of file scopes.h.

194 {
195 return type_check_mode_ == kTypeCheckedByCaller;
196 }

Friends And Related Function Documentation

◆ LocalScope

friend class LocalScope
friend

Definition at line 281 of file scopes.h.

Member Data Documentation

◆ kNoKernelOffset

constexpr intptr_t dart::LocalVariable::kNoKernelOffset = -1
staticconstexpr

Definition at line 77 of file scopes.h.


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