Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::kernel::ParameterDescriptorBuilder Class Reference
Inheritance diagram for dart::kernel::ParameterDescriptorBuilder:
dart::kernel::KernelReaderHelper

Public Member Functions

 ParameterDescriptorBuilder (TranslationHelper *translation_helper, Zone *zone, const TypedDataView &data, intptr_t data_program_offset, ActiveClass *active_class)
 
ObjectPtr BuildParameterDescriptor (const Function &function)
 
- Public Member Functions inherited from dart::kernel::KernelReaderHelper
 KernelReaderHelper (Zone *zone, TranslationHelper *translation_helper, const TypedDataBase &data, intptr_t data_program_offset)
 
virtual ~KernelReaderHelper ()=default
 
void SetOffset (intptr_t offset)
 
intptr_t ReadListLength ()
 
NameIndex ReadCanonicalNameReference ()
 
virtual void ReportUnexpectedTag (const char *variant, Tag tag)
 
void ReadUntilFunctionNode ()
 
Tag PeekTag (uint8_t *payload=nullptr)
 

Additional Inherited Members

- Protected Member Functions inherited from dart::kernel::KernelReaderHelper
virtual void set_current_script_id (intptr_t id)
 
virtual void RecordTokenPosition (TokenPosition position)
 
intptr_t ReaderOffset () const
 
intptr_t ReaderSize () const
 
void SkipBytes (intptr_t skip)
 
bool ReadBool ()
 
uint8_t ReadByte ()
 
uint32_t ReadUInt ()
 
uint32_t ReadUInt32 ()
 
uint32_t PeekUInt ()
 
double ReadDouble ()
 
uint32_t PeekListLength ()
 
StringIndex ReadStringReference ()
 
NameIndex ReadInterfaceMemberNameReference ()
 
StringIndex ReadNameAsStringIndex ()
 
const StringReadNameAsMethodName ()
 
const StringReadNameAsGetterName ()
 
const StringReadNameAsSetterName ()
 
const StringReadNameAsFieldName ()
 
void SkipFlags ()
 
void SkipStringReference ()
 
void SkipConstantReference ()
 
void SkipCanonicalNameReference ()
 
void SkipInterfaceMemberNameReference ()
 
void SkipDartType ()
 
void SkipOptionalDartType ()
 
void SkipInterfaceType (bool simple)
 
void SkipFunctionType (bool simple)
 
void SkipStatementList ()
 
void SkipListOfExpressions ()
 
void SkipListOfNamedExpressions ()
 
void SkipListOfDartTypes ()
 
void SkipListOfStrings ()
 
void SkipListOfVariableDeclarations ()
 
void SkipListOfCanonicalNameReferences ()
 
void SkipTypeParametersList ()
 
void SkipInitializer ()
 
void SkipExpression ()
 
void SkipStatement ()
 
void SkipFunctionNode ()
 
void SkipName ()
 
void SkipArguments ()
 
void SkipVariableDeclaration ()
 
void SkipLibraryCombinator ()
 
void SkipLibraryDependency ()
 
TokenPosition ReadPosition ()
 
Tag ReadTag (uint8_t *payload=nullptr)
 
uint8_t ReadFlags ()
 
Nullability ReadNullability ()
 
Variance ReadVariance ()
 
intptr_t SourceTableSize ()
 
intptr_t GetOffsetForSourceInfo (intptr_t index)
 
StringSourceTableUriFor (intptr_t index)
 
const StringGetSourceFor (intptr_t index)
 
TypedDataPtr GetLineStartsFor (intptr_t index)
 
StringSourceTableImportUriFor (intptr_t index)
 
TypedDataViewPtr GetConstantCoverageFor (intptr_t index)
 
- Protected Attributes inherited from dart::kernel::KernelReaderHelper
Zonezone_
 
TranslationHelpertranslation_helper_
 
Reader reader_
 
intptr_t data_program_offset_
 

Detailed Description

Definition at line 495 of file kernel.cc.

Constructor & Destructor Documentation

◆ ParameterDescriptorBuilder()

dart::kernel::ParameterDescriptorBuilder::ParameterDescriptorBuilder ( TranslationHelper translation_helper,
Zone zone,
const TypedDataView data,
intptr_t  data_program_offset,
ActiveClass active_class 
)
inline

Definition at line 497 of file kernel.cc.

502 : KernelReaderHelper(zone, translation_helper, data, data_program_offset),
503 constant_reader_(this, active_class) {}
KernelReaderHelper(Zone *zone, TranslationHelper *translation_helper, const TypedDataBase &data, intptr_t data_program_offset)
static int8_t data[kExtLength]

Member Function Documentation

◆ BuildParameterDescriptor()

ObjectPtr dart::kernel::ParameterDescriptorBuilder::BuildParameterDescriptor ( const Function function)

Definition at line 513 of file kernel.cc.

514 {
515 SetOffset(function.kernel_offset());
517 FunctionNodeHelper function_node_helper(this);
518 function_node_helper.ReadUntilExcluding(
520 intptr_t param_count = function_node_helper.total_parameter_count_;
521 intptr_t positional_count = ReadListLength(); // read list length.
522 intptr_t named_parameter_count = param_count - positional_count;
523
524 const Array& param_descriptor = Array::Handle(
526 for (intptr_t i = 0; i < param_count; ++i) {
527 const intptr_t entry_start = i * Parser::kParameterEntrySize;
528
529 if (i == positional_count) {
530 intptr_t named_parameter_count_check =
531 ReadListLength(); // read list length.
532 ASSERT(named_parameter_count_check == named_parameter_count);
533 }
534
535 // Read ith variable declaration.
536 intptr_t param_kernel_offset = reader_.offset();
537 VariableDeclarationHelper helper(this);
538 helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
539 param_descriptor.SetAt(entry_start + Parser::kParameterIsFinalOffset,
540 helper.IsFinal() ? Bool::True() : Bool::False());
541
542 Tag tag = ReadTag(); // read (first part of) initializer.
543 if ((tag == kSomething) && !function.is_abstract()) {
544 // This will read the initializer.
545 Instance& constant = Instance::ZoneHandle(
546 zone_, constant_reader_.ReadConstantExpression());
547 param_descriptor.SetAt(entry_start + Parser::kParameterDefaultValueOffset,
548 constant);
549 } else {
550 if (tag == kSomething) {
551 SkipExpression(); // Skip initializer.
552 }
553 param_descriptor.SetAt(entry_start + Parser::kParameterDefaultValueOffset,
554 Object::null_instance());
555 }
556
557 if (FLAG_enable_mirrors && (helper.annotation_count_ > 0)) {
558 AlternativeReadingScope alt(&reader_, param_kernel_offset);
559 VariableDeclarationHelper helper(this);
560 helper.ReadUntilExcluding(VariableDeclarationHelper::kAnnotations);
561 Object& metadata =
562 Object::ZoneHandle(zone_, constant_reader_.ReadAnnotations());
563 param_descriptor.SetAt(entry_start + Parser::kParameterMetadataOffset,
564 metadata);
565 } else {
566 param_descriptor.SetAt(entry_start + Parser::kParameterMetadataOffset,
567 Object::null_instance());
568 }
569 }
570 return param_descriptor.ptr();
571}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
static const Bool & False()
Definition: object.h:10799
static const Bool & True()
Definition: object.h:10797
@ kOld
Definition: heap.h:39
static Object & Handle()
Definition: object.h:407
static Object & ZoneHandle()
Definition: object.h:419
@ kParameterDefaultValueOffset
Definition: parser.h:341
@ kParameterIsFinalOffset
Definition: parser.h:340
@ kParameterMetadataOffset
Definition: parser.h:342
@ kParameterEntrySize
Definition: parser.h:343
Tag ReadTag(uint8_t *payload=nullptr)
intptr_t offset() const
#define ASSERT(E)
Dart_NativeFunction function
Definition: fuchsia.cc:51

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