Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Public Attributes | List of all members
dart::kernel::VariableDeclarationHelper Class Reference

#include <kernel_translation_helper.h>

Public Types

enum  Field {
  kPosition , kEqualPosition , kAnnotations , kFlags ,
  kNameIndex , kType , kInitializer , kEnd
}
 
enum  Flag {
  kFinal = 1 << 0 , kConst = 1 << 1 , kHasDeclaredInitializer = 1 << 2 , kIsGenericCovariantImpl = 1 << 4 ,
  kLate = 1 << 5 , kRequired = 1 << 6 , kCovariant = 1 << 7 , kLowered = 1 << 8 ,
  kSynthesized = 1 << 9 , kHoisted = 1 << 10 , kWildcard = 1 << 11
}
 

Public Member Functions

 VariableDeclarationHelper (KernelReaderHelper *helper)
 
void ReadUntilIncluding (Field field)
 
void ReadUntilExcluding (Field field)
 
void SetNext (Field field)
 
void SetJustRead (Field field)
 
bool IsConst () const
 
bool IsFinal () const
 
bool IsCovariant () const
 
bool IsLate () const
 
bool IsRequired () const
 
bool IsSynthesized () const
 
bool IsHoisted () const
 
bool IsWildcard () const
 
bool HasDeclaredInitializer () const
 
bool IsGenericCovariantImpl () const
 

Public Attributes

TokenPosition position_ = TokenPosition::kNoSource
 
TokenPosition equals_position_ = TokenPosition::kNoSource
 
uint32_t flags_ = 0
 
StringIndex name_index_
 
intptr_t annotation_count_ = 0
 

Detailed Description

Definition at line 398 of file kernel_translation_helper.h.

Member Enumeration Documentation

◆ Field

◆ Flag

Enumerator
kFinal 
kConst 
kHasDeclaredInitializer 
kIsGenericCovariantImpl 
kLate 
kRequired 
kCovariant 
kLowered 
kSynthesized 
kHoisted 
kWildcard 

Definition at line 411 of file kernel_translation_helper.h.

Constructor & Destructor Documentation

◆ VariableDeclarationHelper()

dart::kernel::VariableDeclarationHelper::VariableDeclarationHelper ( KernelReaderHelper helper)
inlineexplicit

Definition at line 425 of file kernel_translation_helper.h.

426 : annotation_count_(0), helper_(helper), next_read_(kPosition) {}

Member Function Documentation

◆ HasDeclaredInitializer()

bool dart::kernel::VariableDeclarationHelper::HasDeclaredInitializer ( ) const
inline

Definition at line 445 of file kernel_translation_helper.h.

◆ IsConst()

bool dart::kernel::VariableDeclarationHelper::IsConst ( ) const
inline

Definition at line 437 of file kernel_translation_helper.h.

437{ return (flags_ & kConst) != 0; }

◆ IsCovariant()

bool dart::kernel::VariableDeclarationHelper::IsCovariant ( ) const
inline

Definition at line 439 of file kernel_translation_helper.h.

439{ return (flags_ & kCovariant) != 0; }

◆ IsFinal()

bool dart::kernel::VariableDeclarationHelper::IsFinal ( ) const
inline

Definition at line 438 of file kernel_translation_helper.h.

438{ return (flags_ & kFinal) != 0; }

◆ IsGenericCovariantImpl()

bool dart::kernel::VariableDeclarationHelper::IsGenericCovariantImpl ( ) const
inline

Definition at line 449 of file kernel_translation_helper.h.

449 {
450 return (flags_ & kIsGenericCovariantImpl) != 0;
451 }

◆ IsHoisted()

bool dart::kernel::VariableDeclarationHelper::IsHoisted ( ) const
inline

Definition at line 443 of file kernel_translation_helper.h.

443{ return (flags_ & kHoisted) != 0; }

◆ IsLate()

bool dart::kernel::VariableDeclarationHelper::IsLate ( ) const
inline

Definition at line 440 of file kernel_translation_helper.h.

440{ return (flags_ & kLate) != 0; }

◆ IsRequired()

bool dart::kernel::VariableDeclarationHelper::IsRequired ( ) const
inline

Definition at line 441 of file kernel_translation_helper.h.

441{ return (flags_ & kRequired) != 0; }

◆ IsSynthesized()

bool dart::kernel::VariableDeclarationHelper::IsSynthesized ( ) const
inline

Definition at line 442 of file kernel_translation_helper.h.

442{ return (flags_ & kSynthesized) != 0; }

◆ IsWildcard()

bool dart::kernel::VariableDeclarationHelper::IsWildcard ( ) const
inline

Definition at line 444 of file kernel_translation_helper.h.

444{ return (flags_ & kWildcard) != 0; }

◆ ReadUntilExcluding()

void dart::kernel::VariableDeclarationHelper::ReadUntilExcluding ( Field  field)

Definition at line 1052 of file kernel_translation_helper.cc.

1052 {
1053 if (field <= next_read_) return;
1054
1055 // Ordered with fall-through.
1056 switch (next_read_) {
1057 case kPosition:
1058 position_ = helper_->ReadPosition(); // read position.
1059 if (++next_read_ == field) return;
1061 case kEqualPosition:
1062 equals_position_ = helper_->ReadPosition(); // read equals position.
1063 if (++next_read_ == field) return;
1065 case kAnnotations:
1066 annotation_count_ = helper_->ReadListLength(); // read list length.
1067 for (intptr_t i = 0; i < annotation_count_; ++i) {
1068 helper_->SkipExpression(); // read ith expression.
1069 }
1070 if (++next_read_ == field) return;
1072 case kFlags:
1073 flags_ = helper_->ReadUInt();
1074 if (++next_read_ == field) return;
1076 case kNameIndex:
1077 name_index_ = helper_->ReadStringReference(); // read name index.
1078 if (++next_read_ == field) return;
1080 case kType:
1081 helper_->SkipDartType(); // read type.
1082 if (++next_read_ == field) return;
1084 case kInitializer:
1085 if (helper_->ReadTag() == kSomething)
1086 helper_->SkipExpression(); // read initializer.
1087 if (++next_read_ == field) return;
1089 case kEnd:
1090 return;
1091 }
1092}
Tag ReadTag(uint8_t *payload=nullptr)
#define FALL_THROUGH
Definition: globals.h:15

◆ ReadUntilIncluding()

void dart::kernel::VariableDeclarationHelper::ReadUntilIncluding ( Field  field)
inline

Definition at line 428 of file kernel_translation_helper.h.

428 {
429 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
430 }

◆ SetJustRead()

void dart::kernel::VariableDeclarationHelper::SetJustRead ( Field  field)
inline

Definition at line 435 of file kernel_translation_helper.h.

435{ next_read_ = field + 1; }

◆ SetNext()

void dart::kernel::VariableDeclarationHelper::SetNext ( Field  field)
inline

Definition at line 434 of file kernel_translation_helper.h.

434{ next_read_ = field; }

Member Data Documentation

◆ annotation_count_

intptr_t dart::kernel::VariableDeclarationHelper::annotation_count_ = 0

Definition at line 457 of file kernel_translation_helper.h.

◆ equals_position_

TokenPosition dart::kernel::VariableDeclarationHelper::equals_position_ = TokenPosition::kNoSource

Definition at line 454 of file kernel_translation_helper.h.

◆ flags_

uint32_t dart::kernel::VariableDeclarationHelper::flags_ = 0

Definition at line 455 of file kernel_translation_helper.h.

◆ name_index_

StringIndex dart::kernel::VariableDeclarationHelper::name_index_

Definition at line 456 of file kernel_translation_helper.h.

◆ position_

TokenPosition dart::kernel::VariableDeclarationHelper::position_ = TokenPosition::kNoSource

Definition at line 453 of file kernel_translation_helper.h.


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