180 {
185 const intptr_t num_params = num_fixed_params + num_opt_params;
187
188
189
190
191
192 raw_parameters_ =
new (
Z) ZoneGrowableArray<LocalVariable*>(
Z, num_params);
193 for (intptr_t param = 0; param < num_params; ++param) {
195 LocalVariable* raw_parameter = variable;
196 if (variable->is_captured()) {
199
201 tmp, variable->kernel_offset()) == nullptr);
202 raw_parameter = new LocalVariable(
203 variable->declaration_token_pos(), variable->token_pos(), tmp,
204 variable->static_type(), variable->kernel_offset(),
205 variable->inferred_type(), variable->inferred_arg_type(),
206 variable->inferred_arg_value());
207 raw_parameter->set_annotations_offset(variable->annotations_offset());
208 if (variable->is_explicit_covariant_parameter()) {
209 raw_parameter->set_is_explicit_covariant_parameter();
210 }
211 if (variable->needs_covariant_check_in_method()) {
212 raw_parameter->set_needs_covariant_check_in_method();
213 }
214 raw_parameter->set_type_check_mode(variable->type_check_mode());
215 if (copy_parameters) {
218
219
220
221
222
223
224
225
226
227
228
229
230
231 const bool is_receiver_var =
233 if (!is_receiver_var) {
235 }
236
237 } else {
238 raw_parameter->set_index(
239 VariableIndex(
function().NumParameters() - param));
240 }
241 }
242 raw_parameters_->Add(raw_parameter);
243 }
244 if (function_type_arguments_ != nullptr) {
245 LocalVariable* raw_type_args_parameter = function_type_arguments_;
249 function_type_arguments_->
name());
250
253 raw_type_args_parameter =
255 function_type_arguments_->
token_pos(), tmp,
260 }
261 raw_type_arguments_var_ = raw_type_args_parameter;
262 }
263
264
265
266 VariableIndex first_local_index;
267 {
268
269
270 if (!copy_parameters) {
272 first_parameter_index_ = VariableIndex(num_params);
273 first_local_index = VariableIndex(0);
274 } else {
275
276
277 const intptr_t reserved_var_slot_count =
279 first_parameter_index_ = VariableIndex(-reserved_var_slot_count);
280 first_local_index =
281 VariableIndex(first_parameter_index_.
value() - num_params);
282 }
283 }
284
285
286
287 bool found_captured_variables = false;
289 function(), first_parameter_index_, num_params, first_local_index,
290 nullptr, &found_captured_variables);
291
292 num_stack_locals_ = -next_free_index.value();
293}
static bool ok(int result)
#define RELEASE_ASSERT(cond)
intptr_t NumOptionalParameters() const
bool MakesCopyOfParameters() const
bool HasThisParameter() const
VariableIndex AllocateVariables(const Function &function, VariableIndex first_parameter_index, int num_parameters, VariableIndex first_local_index, LocalScope *context_owner, bool *found_captured_variables)
bool AddVariable(LocalVariable *variable)
LocalVariable * LocalLookupVariable(const String &name, intptr_t kernel_offset) const
TokenPosition declaration_token_pos() const
TokenPosition token_pos() const
const AbstractType & static_type() const
intptr_t kernel_offset() const
const String & name() const
void set_is_captured_parameter(bool value)
LocalScope * scope() const
LocalVariable * ParameterVariable(intptr_t i) const
LocalVariable * suspend_state_var() const
static StringPtr FromConcat(Thread *thread, const String &str1, const String &str2)