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

#include <kernel_translation_helper.h>

Public Member Functions

 ActiveTypeParametersScope (ActiveClass *active_class, const Function &innermost, const FunctionType *innermost_signature, Zone *Z)
 
 ActiveTypeParametersScope (ActiveClass *active_class, const FunctionType *innermost_signature, Zone *Z)
 
 ~ActiveTypeParametersScope ()
 

Detailed Description

Definition at line 1512 of file kernel_translation_helper.h.

Constructor & Destructor Documentation

◆ ActiveTypeParametersScope() [1/2]

dart::kernel::ActiveTypeParametersScope::ActiveTypeParametersScope ( ActiveClass active_class,
const Function innermost,
const FunctionType innermost_signature,
Zone Z 
)

Definition at line 3219 of file kernel_translation_helper.cc.

3224 : active_class_(active_class), saved_(*active_class), zone_(Z) {
3225 active_class_->enclosing = innermost_signature;
3226
3227 intptr_t num_params = 0;
3228
3229 Function& f = Function::Handle(Z);
3230 for (f = innermost.ptr(); f.parent_function() != Object::null();
3231 f = f.parent_function()) {
3232 num_params += f.NumTypeParameters();
3233 }
3234 if (num_params == 0) return;
3235
3236 TypeArguments& params =
3238
3239 intptr_t index = num_params;
3240 for (f = innermost.ptr(); f.parent_function() != Object::null();
3241 f = f.parent_function()) {
3242 for (intptr_t j = f.NumTypeParameters() - 1; j >= 0; --j) {
3243 const auto& type_param = TypeParameter::Handle(Z, f.TypeParameterAt(j));
3244 params.SetTypeAt(--index, type_param);
3245 }
3246 }
3247
3248 active_class_->local_type_parameters = &params;
3249}
#define Z
static ObjectPtr null()
Definition object.h:433
static Object & Handle()
Definition object.h:407
static TypeArgumentsPtr New(intptr_t len, Heap::Space space=Heap::kOld)
Definition object.cc:7733
const TypeArguments * local_type_parameters
const EmbeddedViewParams * params

◆ ActiveTypeParametersScope() [2/2]

dart::kernel::ActiveTypeParametersScope::ActiveTypeParametersScope ( ActiveClass active_class,
const FunctionType innermost_signature,
Zone Z 
)

Definition at line 3251 of file kernel_translation_helper.cc.

3255 : active_class_(active_class), saved_(*active_class), zone_(Z) {
3256 active_class_->enclosing = innermost_signature;
3257
3258 const intptr_t num_new_params =
3259 innermost_signature == nullptr ? active_class->klass->NumTypeParameters()
3260 : innermost_signature->NumTypeParameters();
3261 if (num_new_params == 0) return;
3262
3263 const TypeArguments* old_params = active_class->local_type_parameters;
3264 const intptr_t old_param_count =
3265 old_params == nullptr ? 0 : old_params->Length();
3266 const TypeArguments& extended_params = TypeArguments::Handle(
3267 Z, TypeArguments::New(old_param_count + num_new_params));
3268
3269 intptr_t index = 0;
3270 for (intptr_t i = 0; i < old_param_count; ++i) {
3271 extended_params.SetTypeAt(index++,
3272 AbstractType::Handle(Z, old_params->TypeAt(i)));
3273 }
3274 for (intptr_t i = 0; i < num_new_params; ++i) {
3275 const auto& type_param =
3276 TypeParameter::Handle(Z, innermost_signature == nullptr
3277 ? active_class->klass->TypeParameterAt(i)
3278 : innermost_signature->TypeParameterAt(i));
3279 extended_params.SetTypeAt(index++, type_param);
3280 }
3281
3282 active_class_->local_type_parameters = &extended_params;
3283}
intptr_t NumTypeParameters() const
Definition object.h:9558

◆ ~ActiveTypeParametersScope()

dart::kernel::ActiveTypeParametersScope::~ActiveTypeParametersScope ( )

Definition at line 3285 of file kernel_translation_helper.cc.

3285 {
3286 *active_class_ = saved_;
3287}

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