Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
dart::kernel::ClassHelper Class Reference

#include <kernel_translation_helper.h>

Public Types

enum  Field {
  kStart , kCanonicalName , kSourceUriIndex , kStartPosition ,
  kPosition , kEndPosition , kFlags , kNameIndex ,
  kAnnotations , kTypeParameters , kSuperClass , kMixinType ,
  kImplementedClasses , kFields , kConstructors , kProcedures ,
  kClassIndex , kEnd
}
 
enum  Flag {
  kIsAbstract = 1 << 0 , kIsEnumClass = 1 << 1 , kIsAnonymousMixin = 1 << 2 , kIsEliminatedMixin = 1 << 3 ,
  kFlagMixinDeclaration = 1 << 4 , kHasConstConstructor = 1 << 5 , kIsMacro = 1 << 6 , kIsSealed = 1 << 7 ,
  kIsMixinClass = 1 << 8 , kIsBase = 1 << 9 , kIsInterface = 1 << 10 , kIsFinal = 1 << 11
}
 

Public Member Functions

 ClassHelper (KernelReaderHelper *helper)
 
void ReadUntilIncluding (Field field)
 
void ReadUntilExcluding (Field field)
 
void SetNext (Field field)
 
void SetJustRead (Field field)
 
bool is_abstract () const
 
bool is_enum_class () const
 
bool is_transformed_mixin_application () const
 
bool has_const_constructor () const
 
bool is_sealed () const
 
bool is_mixin_class () const
 
bool is_base () const
 
bool is_interface () const
 
bool is_final () const
 

Public Attributes

NameIndex canonical_name_
 
TokenPosition start_position_ = TokenPosition::kNoSource
 
TokenPosition position_ = TokenPosition::kNoSource
 
TokenPosition end_position_ = TokenPosition::kNoSource
 
StringIndex name_index_
 
intptr_t source_uri_index_ = 0
 
intptr_t annotation_count_ = 0
 
intptr_t procedure_count_ = 0
 
uint32_t flags_ = 0
 

Detailed Description

Definition at line 727 of file kernel_translation_helper.h.

Member Enumeration Documentation

◆ Field

Enumerator
kStart 
kCanonicalName 
kSourceUriIndex 
kStartPosition 
kPosition 
kEndPosition 
kFlags 
kNameIndex 
kAnnotations 
kTypeParameters 
kSuperClass 
kMixinType 
kImplementedClasses 
kFields 
kConstructors 
kProcedures 
kClassIndex 
kEnd 

Definition at line 729 of file kernel_translation_helper.h.

729 {
730 kStart, // tag.
734 kPosition,
736 kFlags,
743 kFields,
747 kEnd,
748 };

◆ Flag

Enumerator
kIsAbstract 
kIsEnumClass 
kIsAnonymousMixin 
kIsEliminatedMixin 
kFlagMixinDeclaration 
kHasConstConstructor 
kIsMacro 
kIsSealed 
kIsMixinClass 
kIsBase 
kIsInterface 
kIsFinal 

Definition at line 750 of file kernel_translation_helper.h.

750 {
751 kIsAbstract = 1 << 0,
752 kIsEnumClass = 1 << 1,
753 kIsAnonymousMixin = 1 << 2,
754 kIsEliminatedMixin = 1 << 3,
755 kFlagMixinDeclaration = 1 << 4,
756 kHasConstConstructor = 1 << 5,
757 kIsMacro = 1 << 6,
758 kIsSealed = 1 << 7,
759 kIsMixinClass = 1 << 8,
760 kIsBase = 1 << 9,
761 kIsInterface = 1 << 10,
762 kIsFinal = 1 << 11,
763 };

Constructor & Destructor Documentation

◆ ClassHelper()

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

Definition at line 765 of file kernel_translation_helper.h.

766 : helper_(helper), next_read_(kStart) {}

Member Function Documentation

◆ has_const_constructor()

bool dart::kernel::ClassHelper::has_const_constructor ( ) const
inline

Definition at line 785 of file kernel_translation_helper.h.

◆ is_abstract()

bool dart::kernel::ClassHelper::is_abstract ( ) const
inline

Definition at line 777 of file kernel_translation_helper.h.

777{ return (flags_ & Flag::kIsAbstract) != 0; }

◆ is_base()

bool dart::kernel::ClassHelper::is_base ( ) const
inline

Definition at line 793 of file kernel_translation_helper.h.

793{ return (flags_ & Flag::kIsBase) != 0; }

◆ is_enum_class()

bool dart::kernel::ClassHelper::is_enum_class ( ) const
inline

Definition at line 779 of file kernel_translation_helper.h.

779{ return (flags_ & Flag::kIsEnumClass) != 0; }

◆ is_final()

bool dart::kernel::ClassHelper::is_final ( ) const
inline

Definition at line 797 of file kernel_translation_helper.h.

797{ return (flags_ & Flag::kIsFinal) != 0; }

◆ is_interface()

bool dart::kernel::ClassHelper::is_interface ( ) const
inline

Definition at line 795 of file kernel_translation_helper.h.

795{ return (flags_ & Flag::kIsInterface) != 0; }

◆ is_mixin_class()

bool dart::kernel::ClassHelper::is_mixin_class ( ) const
inline

Definition at line 791 of file kernel_translation_helper.h.

791{ return (flags_ & Flag::kIsMixinClass) != 0; }

◆ is_sealed()

bool dart::kernel::ClassHelper::is_sealed ( ) const
inline

Definition at line 789 of file kernel_translation_helper.h.

789{ return (flags_ & Flag::kIsSealed) != 0; }

◆ is_transformed_mixin_application()

bool dart::kernel::ClassHelper::is_transformed_mixin_application ( ) const
inline

Definition at line 781 of file kernel_translation_helper.h.

781 {
782 return (flags_ & Flag::kIsEliminatedMixin) != 0;
783 }

◆ ReadUntilExcluding()

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

Definition at line 1315 of file kernel_translation_helper.cc.

1315 {
1316 if (field <= next_read_) return;
1317
1318 // Ordered with fall-through.
1319 switch (next_read_) {
1320 case kStart: {
1321 Tag tag = helper_->ReadTag(); // read tag.
1322 ASSERT(tag == kClass);
1323 if (++next_read_ == field) return;
1324 }
1326 case kCanonicalName:
1328 helper_->ReadCanonicalNameReference(); // read canonical_name.
1329 if (++next_read_ == field) return;
1331 case kSourceUriIndex:
1332 source_uri_index_ = helper_->ReadUInt(); // read source_uri_index.
1334 if (++next_read_ == field) return;
1336 case kStartPosition:
1337 start_position_ = helper_->ReadPosition(); // read position.
1338 if (++next_read_ == field) return;
1340 case kPosition:
1341 position_ = helper_->ReadPosition(); // read position.
1342 if (++next_read_ == field) return;
1344 case kEndPosition:
1345 end_position_ = helper_->ReadPosition(); // read end position.
1346 if (++next_read_ == field) return;
1348 case kFlags:
1349 flags_ = helper_->ReadUInt(); // read flags.
1350 if (++next_read_ == field) return;
1352 case kNameIndex:
1353 name_index_ = helper_->ReadStringReference(); // read name index.
1354 if (++next_read_ == field) return;
1356 case kAnnotations: {
1357 annotation_count_ = helper_->ReadListLength(); // read list length.
1358 for (intptr_t i = 0; i < annotation_count_; ++i) {
1359 helper_->SkipExpression(); // read ith expression.
1360 }
1361 if (++next_read_ == field) return;
1362 }
1364 case kTypeParameters:
1365 helper_->SkipTypeParametersList(); // read type parameters.
1366 if (++next_read_ == field) return;
1368 case kSuperClass: {
1369 Tag type_tag = helper_->ReadTag(); // read super class type (part 1).
1370 if (type_tag == kSomething) {
1371 helper_->SkipDartType(); // read super class type (part 2).
1372 }
1373 if (++next_read_ == field) return;
1374 }
1376 case kMixinType: {
1377 Tag type_tag = helper_->ReadTag(); // read mixin type (part 1).
1378 if (type_tag == kSomething) {
1379 helper_->SkipDartType(); // read mixin type (part 2).
1380 }
1381 if (++next_read_ == field) return;
1382 }
1385 helper_->SkipListOfDartTypes(); // read implemented_classes.
1386 if (++next_read_ == field) return;
1388 case kFields: {
1389 intptr_t list_length =
1390 helper_->ReadListLength(); // read fields list length.
1391 for (intptr_t i = 0; i < list_length; i++) {
1392 FieldHelper field_helper(helper_);
1393 field_helper.ReadUntilExcluding(FieldHelper::kEnd); // read field.
1394 }
1395 if (++next_read_ == field) return;
1396 }
1398 case kConstructors: {
1399 intptr_t list_length =
1400 helper_->ReadListLength(); // read constructors list length.
1401 for (intptr_t i = 0; i < list_length; i++) {
1402 ConstructorHelper constructor_helper(helper_);
1403 constructor_helper.ReadUntilExcluding(
1404 ConstructorHelper::kEnd); // read constructor.
1405 }
1406 if (++next_read_ == field) return;
1407 }
1409 case kProcedures: {
1410 procedure_count_ = helper_->ReadListLength(); // read procedures #.
1411 for (intptr_t i = 0; i < procedure_count_; i++) {
1412 ProcedureHelper procedure_helper(helper_);
1413 procedure_helper.ReadUntilExcluding(
1414 ProcedureHelper::kEnd); // read procedure.
1415 }
1416 if (++next_read_ == field) return;
1417 }
1419 case kClassIndex:
1420 // Read class index.
1421 for (intptr_t i = 0; i < procedure_count_; ++i) {
1422 helper_->reader_.ReadUInt32();
1423 }
1424 helper_->reader_.ReadUInt32();
1425 helper_->reader_.ReadUInt32();
1426 if (++next_read_ == field) return;
1428 case kEnd:
1429 return;
1430 }
1431}
Tag ReadTag(uint8_t *payload=nullptr)
virtual void set_current_script_id(intptr_t id)
#define ASSERT(E)
#define FALL_THROUGH
Definition globals.h:15

◆ ReadUntilIncluding()

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

Definition at line 768 of file kernel_translation_helper.h.

768 {
769 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
770 }

◆ SetJustRead()

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

Definition at line 775 of file kernel_translation_helper.h.

775{ next_read_ = field + 1; }

◆ SetNext()

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

Definition at line 774 of file kernel_translation_helper.h.

774{ next_read_ = field; }

Member Data Documentation

◆ annotation_count_

intptr_t dart::kernel::ClassHelper::annotation_count_ = 0

Definition at line 805 of file kernel_translation_helper.h.

◆ canonical_name_

NameIndex dart::kernel::ClassHelper::canonical_name_

Definition at line 799 of file kernel_translation_helper.h.

◆ end_position_

TokenPosition dart::kernel::ClassHelper::end_position_ = TokenPosition::kNoSource

Definition at line 802 of file kernel_translation_helper.h.

◆ flags_

uint32_t dart::kernel::ClassHelper::flags_ = 0

Definition at line 807 of file kernel_translation_helper.h.

◆ name_index_

StringIndex dart::kernel::ClassHelper::name_index_

Definition at line 803 of file kernel_translation_helper.h.

◆ position_

TokenPosition dart::kernel::ClassHelper::position_ = TokenPosition::kNoSource

Definition at line 801 of file kernel_translation_helper.h.

◆ procedure_count_

intptr_t dart::kernel::ClassHelper::procedure_count_ = 0

Definition at line 806 of file kernel_translation_helper.h.

◆ source_uri_index_

intptr_t dart::kernel::ClassHelper::source_uri_index_ = 0

Definition at line 804 of file kernel_translation_helper.h.

◆ start_position_

TokenPosition dart::kernel::ClassHelper::start_position_ = TokenPosition::kNoSource

Definition at line 800 of file kernel_translation_helper.h.


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