1use crate::ns::*;
2
3pub struct Factory<'a>(pub(crate) &'a Database);
4
5impl<'a> Factory<'a> {
6 pub fn create_public_ns(&self, parent: Option<Entity>) -> Entity {
7 SystemNamespace::new(&self.0.arena, SystemNamespaceKind::Public, parent).into()
8 }
9
10 pub fn create_private_ns(&self, parent: Option<Entity>) -> Entity {
11 SystemNamespace::new(&self.0.arena, SystemNamespaceKind::Private, parent).into()
12 }
13
14 pub fn create_protected_ns(&self, parent: Option<Entity>) -> Entity {
15 SystemNamespace::new(&self.0.arena, SystemNamespaceKind::Protected, parent).into()
16 }
17
18 pub fn create_static_protected_ns(&self, parent: Option<Entity>) -> Entity {
19 SystemNamespace::new(&self.0.arena, SystemNamespaceKind::StaticProtected, parent).into()
20 }
21
22 pub fn create_internal_ns(&self, parent: Option<Entity>) -> Entity {
23 SystemNamespace::new(&self.0.arena, SystemNamespaceKind::Internal, parent).into()
24 }
25
26 pub fn create_explicit_ns(&self, uri: String) -> Entity {
27 let mut mappings = self.0.explicit_namespaces.borrow_mut();
28 if let Some(ns) = mappings.get(&uri) {
29 return ns.clone();
30 }
31 let ns: Entity = ExplicitNamespace::new(&self.0.arena, uri.clone()).into();
32 mappings.insert(uri, ns.clone());
33 ns
34 }
35
36 pub fn create_user_ns(&self, uri: String) -> Entity {
37 let mut mappings = self.0.user_namespaces.borrow_mut();
38 if let Some(ns) = mappings.get(&uri) {
39 return ns.clone();
40 }
41 let ns: Entity = UserNamespace::new(&self.0.arena, uri.clone()).into();
42 mappings.insert(uri, ns.clone());
43 ns
44 }
45
46 pub fn create_qname(&self, namespace: &Entity, local_name: String) -> QName {
47 let mut ns_mappings = self.0.qnames.borrow_mut();
48 if let Some(qn_mappings) = ns_mappings.get_mut(namespace) {
49 if let Some(qn) = qn_mappings.get(&local_name) {
50 return qn.clone();
51 }
52 let qn = QName(Rc::new(QName1 {
53 m_namespace: namespace.clone(),
54 m_local_name: local_name.clone(),
55 }));
56 qn_mappings.insert(local_name, qn.clone());
57 return qn;
58 }
59 let qn = QName(Rc::new(QName1 {
60 m_namespace: namespace.clone(),
61 m_local_name: local_name.clone(),
62 }));
63 let mut qn_mappings = HashMap::new();
64 qn_mappings.insert(local_name, qn.clone());
65 ns_mappings.insert(namespace.clone(), qn_mappings);
66 qn
67 }
68
69 pub fn create_package<'b>(&self, name: impl IntoIterator<Item = &'b str>) -> Entity {
77 self.create_package_1(&name.into_iter().collect())
78 }
79
80 fn create_package_1(&self, name: &Vec<&str>) -> Entity {
81 let mut result: Entity = self.0.top_level_package.clone();
82 for name_1 in name {
83 let name_1 = (*name_1).to_owned();
84 let result_1 = result.subpackages().get(&name_1);
85 if let Some(result_1) = result_1 {
86 result = result_1;
87 } else {
88 let result_1 = Package::new(&self.0.arena, name_1.clone());
89 result_1.set_parent(Some(result.clone().into()));
90
91 result_1.set_public_ns(Some(self.create_public_ns(Some(result_1.clone().into()))));
93 result_1.set_internal_ns(Some(self.create_internal_ns(Some(result_1.clone().into()))));
94
95 result.subpackages().set(name_1, result_1.clone().into());
96 result = result_1.into();
97 }
98 }
99 result
100 }
101
102 pub fn create_alias(&self, name: QName, alias_of: Entity) -> Entity {
103 Alias::new(&self.0.arena, name, alias_of).into()
104 }
105
106 pub fn create_class_type(&self, name: QName, ns_for_prototype: &Entity) -> Entity {
111 let r = ClassType::new(&self.0.arena, name);
112 r.set_private_ns(Some(self.create_private_ns(Some(r.clone().into()))));
113 r.set_protected_ns(Some(self.create_protected_ns(Some(r.clone().into()))));
114 r.set_static_protected_ns(Some(self.create_static_protected_ns(Some(r.clone().into()))));
115
116 let prototype_name = self.create_qname(&ns_for_prototype, "prototype".into());
118 let prototype_slot = self.create_variable_slot(&prototype_name, true, &self.0.any_type());
119 r.properties(self.0).set(prototype_name.clone(), prototype_slot);
120
121 r.into()
122 }
123
124 pub fn create_enum_type(&self, name: QName, ns_for_prototype: &Entity) -> Entity {
125 let r = EnumType::new(&self.0.arena, name);
126 r.set_private_ns(Some(self.create_private_ns(Some(r.clone().into()))));
127
128 let prototype_name = self.create_qname(&ns_for_prototype, "prototype".into());
130 let prototype_slot = self.create_variable_slot(&prototype_name, true, &self.0.any_type());
131 r.properties(self.0).set(prototype_name.clone(), prototype_slot);
132
133 r.into()
134 }
135
136 pub fn create_interface_type(&self, name: QName) -> Entity {
137 let r = InterfaceType::new(&self.0.arena, name);
138 r.into()
139 }
140
141 pub fn create_type_after_substitution(&self, origin: &Entity, substitute_types: &SharedArray<Entity>) -> Entity {
143 let params = origin.type_params().unwrap();
145 let param_count = params.length();
146 assert_eq!(substitute_types.length(), param_count);
147
148 let mut tas_list = self.0.types_after_sub.borrow_mut();
149
150 let mut list = tas_list.get(&origin);
151 let empty_list = vec![];
152 if list.is_none() {
153 list = Some(&empty_list);
154 tas_list.insert(origin.clone(), vec![]);
155 }
156 'tas: for tas in list.unwrap() {
157 let mut substitute_types_1 = substitute_types.iter();
158 let substitute_types_2 = tas.substitute_types();
159 let mut substitute_types_2 = substitute_types_2.iter();
160 while let Some(substitute_type_1) = substitute_types_1.next() {
161 let substitute_type_2 = substitute_types_2.next().unwrap();
162 if substitute_type_1 != substitute_type_2 {
163 continue 'tas;
164 }
165 }
166 return tas.clone();
167 }
168
169 let tas = TypeAfterSubstitution::new(&self.0.arena, origin.clone(), substitute_types.clone());
170 let list = tas_list.get_mut(&origin).unwrap();
171 list.push(tas.clone().into());
172
173 tas.into()
174 }
175
176 pub fn create_tuple_type(&self, element_types: Vec<Entity>) -> Entity {
178 let element_count = element_types.len();
179 let mut tuple_types = self.0.tuple_types.borrow_mut();
180 let mut collection = tuple_types.get_mut(&element_count);
181 let mut empty_collection = vec![];
182 if collection.is_none() {
183 collection = Some(&mut empty_collection);
184 tuple_types.insert(element_count, vec![]);
185 }
186 'tt: for tt in collection.unwrap() {
187 let mut element_types_1 = element_types.iter();
188 let element_types_2 = tt.element_types();
189 let mut element_types_2 = element_types_2.iter();
190 while let Some(e_1) = element_types_1.next() {
191 let e_2 = element_types_2.next().unwrap();
192 if e_1 != &e_2 {
193 continue 'tt;
194 }
195 }
196 return tt.clone();
197 }
198 let tt = TupleType::new(&self.0.arena, SharedArray::from(element_types));
199
200 let collection = tuple_types.get_mut(&element_count);
201 collection.unwrap().push(tt.clone().into());
202
203 tt.into()
204 }
205
206 pub fn create_function_type(&self, params: Vec<Rc<SemanticFunctionTypeParameter>>, result_type: Entity) -> Entity {
208 let param_count = params.len();
209 let mut function_types = self.0.function_types.borrow_mut();
210 let mut collection = function_types.get_mut(¶m_count);
211 let mut empty_collection = vec![];
212 if collection.is_none() {
213 collection = Some(&mut empty_collection);
214 function_types.insert(params.len(), vec![]);
215 }
216 'ft: for ft in collection.unwrap() {
217 if result_type != ft.result_type() {
218 continue 'ft;
219 }
220 let mut params_1 = params.iter();
221 let params_2 = ft.params();
222 let mut params_2 = params_2.iter();
223 while let Some(param_1) = params_1.next() {
224 let param_2 = params_2.next().unwrap();
225 if !(param_1.kind == param_2.kind && && param_1.static_type == &¶m_2.static_type) {
226 continue 'ft;
227 }
228 }
229 return ft.clone();
230 }
231 let ft = FunctionType::new(&self.0.arena, SharedArray::from(params), result_type);
232
233 let collection = function_types.get_mut(¶m_count);
234 collection.unwrap().push(ft.clone().into());
235
236 ft.into()
237 }
238
239 pub fn create_nullable_type(&self, base: &Entity) -> Entity {
241 if base == &self.0.any_type() || base.is::<NullableType>() || base.is::<InvalidationEntity>() {
242 return base.clone();
243 }
244 if base.is::<NonNullableType>() {
245 return base.base();
246 }
247 let mut m = self.0.nullable_types.borrow_mut();
248 let nt = m.get(base);
249 if let Some(nt) = nt {
250 return nt.clone();
251 }
252 let nt = NullableType::new(&self.0.arena, base.clone());
253 m.insert(base.clone(), nt.clone().into());
254 nt.into()
255 }
256
257 pub fn create_non_nullable_type(&self, base: &Entity) -> Entity {
259 if base == &self.0.any_type() || base.is::<NonNullableType>() || base.is::<InvalidationEntity>() {
260 return base.clone();
261 }
262 let mut m = self.0.non_nullable_types.borrow_mut();
263 let nt = m.get(base);
264 if let Some(nt) = nt {
265 return nt.clone();
266 }
267 let nt = NonNullableType::new(&self.0.arena, base.clone());
268 m.insert(base.clone(), nt.clone().into());
269 nt.into()
270 }
271
272 pub fn create_type_parameter_type(&self, name: &QName) -> Entity {
273 TypeParameterType::new(&self.0.arena, name.clone()).into()
274 }
275
276 pub fn create_variable_slot(&self, name: &QName, read_only: bool, static_type: &Entity) -> Entity {
277 OriginalVariableSlot::new(&self.0.arena, name, read_only, static_type).into()
278 }
279
280 pub fn create_variable_slot_after_substitution(&self, origin: &Entity, indirect_type_params: &SharedArray<Entity>, indirect_substitute_types: &SharedArray<Entity>) -> Entity {
282 assert_eq!(indirect_type_params.length(), indirect_substitute_types.length());
284
285 let mut vasub_list = self.0.vasub.borrow_mut();
286
287 let mut base_list = vasub_list.get_mut(origin);
288 let mut empty_base_list = HashMap::<SharedArray<Entity>, Vec<Entity>>::new();
289 if base_list.is_none() {
290 base_list = Some(&mut empty_base_list);
291 vasub_list.insert(origin.clone(), HashMap::new());
292 }
293 let base_list = base_list.unwrap();
294
295 let mut list = base_list.get(indirect_type_params);
296 let empty_list = vec![];
297 if list.is_none() {
298 list = Some(&empty_list);
299 base_list.insert(indirect_type_params.clone(), vec![]);
300 }
301 'vasub: for vasub in list.unwrap() {
302 let mut substitute_types_1 = indirect_substitute_types.iter();
303 let substitute_types_2 = vasub.indirect_substitute_types();
304 let mut substitute_types_2 = substitute_types_2.iter();
305 while let Some(substitute_type_1) = substitute_types_1.next() {
306 let substitute_type_2 = substitute_types_2.next().unwrap();
307 if substitute_type_1 != substitute_type_2 {
308 continue 'vasub;
309 }
310 }
311 return vasub.clone();
312 }
313
314 let vasub = VariableSlotAfterSubstitution::new(
315 &self.0.arena,
316 &origin,
317 &indirect_type_params,
318 &indirect_substitute_types.clone());
319
320 let list = vasub_list.get_mut(origin).unwrap().get_mut(&indirect_type_params).unwrap();
321 list.push(vasub.clone().into());
322
323 vasub.into()
324 }
325
326 pub fn create_virtual_slot(&self, name: &QName) -> Entity {
327 OriginalVirtualSlot::new(&self.0.arena, name).into()
328 }
329
330 pub fn create_virtual_slot_after_substitution(&self, origin: &Entity, indirect_type_params: &SharedArray<Entity>, indirect_substitute_types: &SharedArray<Entity>) -> Entity {
332 assert_eq!(indirect_type_params.length(), indirect_substitute_types.length());
334
335 let mut visub_list = self.0.visub.borrow_mut();
336
337 let mut base_list = visub_list.get_mut(origin);
338 let mut empty_base_list = HashMap::<SharedArray<Entity>, Vec<Entity>>::new();
339 if base_list.is_none() {
340 base_list = Some(&mut empty_base_list);
341 visub_list.insert(origin.clone(), HashMap::new());
342 }
343 let base_list = base_list.unwrap();
344
345 let mut list = base_list.get(indirect_type_params);
346 let empty_list = vec![];
347 if list.is_none() {
348 list = Some(&empty_list);
349 base_list.insert(indirect_type_params.clone(), vec![]);
350 }
351 'visub: for visub in list.unwrap() {
352 let mut substitute_types_1 = indirect_substitute_types.iter();
353 let substitute_types_2 = visub.indirect_substitute_types();
354 let mut substitute_types_2 = substitute_types_2.iter();
355 while let Some(substitute_type_1) = substitute_types_1.next() {
356 let substitute_type_2 = substitute_types_2.next().unwrap();
357 if substitute_type_1 != substitute_type_2 {
358 continue 'visub;
359 }
360 }
361 return visub.clone();
362 }
363
364 let visub = VirtualSlotAfterSubstitution::new(
365 &self.0.arena,
366 &origin,
367 &indirect_type_params,
368 &indirect_substitute_types.clone());
369
370 let list = visub_list.get_mut(origin).unwrap().get_mut(&indirect_type_params).unwrap();
371 list.push(visub.clone().into());
372
373 visub.into()
374 }
375
376 pub fn create_method_slot(&self, name: &QName, signature: &Entity) -> Entity {
377 OriginalMethodSlot::new(&self.0.arena, name, signature).into()
378 }
379
380 pub fn create_method_slot_after_substitution(&self, origin: &Entity, indirect_type_params: &SharedArray<Entity>, indirect_substitute_types: &SharedArray<Entity>) -> Entity {
382 assert_eq!(indirect_type_params.length(), indirect_substitute_types.length());
384
385 let mut mssub_list = self.0.mssub.borrow_mut();
386
387 let mut base_list = mssub_list.get_mut(origin);
388 let mut empty_base_list = HashMap::<SharedArray<Entity>, Vec<Entity>>::new();
389 if base_list.is_none() {
390 base_list = Some(&mut empty_base_list);
391 mssub_list.insert(origin.clone(), HashMap::new());
392 }
393 let base_list = base_list.unwrap();
394
395 let mut list = base_list.get(indirect_type_params);
396 let empty_list = vec![];
397 if list.is_none() {
398 list = Some(&empty_list);
399 base_list.insert(indirect_type_params.clone(), vec![]);
400 }
401 'mssub: for mssub in list.unwrap() {
402 let mut substitute_types_1 = indirect_substitute_types.iter();
403 let substitute_types_2 = mssub.indirect_substitute_types();
404 let mut substitute_types_2 = substitute_types_2.iter();
405 while let Some(substitute_type_1) = substitute_types_1.next() {
406 let substitute_type_2 = substitute_types_2.next().unwrap();
407 if substitute_type_1 != substitute_type_2 {
408 continue 'mssub;
409 }
410 }
411 return mssub.clone();
412 }
413
414 let mssub = MethodSlotAfterSubstitution::new(
415 &self.0.arena,
416 &origin,
417 &indirect_type_params,
418 &indirect_substitute_types.clone());
419
420 let list = mssub_list.get_mut(origin).unwrap().get_mut(&indirect_type_params).unwrap();
421 list.push(mssub.clone().into());
422
423 mssub.into()
424 }
425
426 pub fn create_scope(&self) -> Entity {
427 Scope::new(&self.0.arena).into()
428 }
429
430 pub fn create_with_scope(&self, object: &Entity) -> Entity {
431 WithScope::new(&self.0.arena, object).into()
432 }
433
434 pub fn create_filter_scope(&self, base: &Entity) -> Entity {
435 FilterScope::new(&self.0.arena, base).into()
436 }
437
438 pub fn create_activation(&self, of_method: &Entity) -> Entity {
439 Activation::new(&self.0.arena, of_method).into()
440 }
441
442 pub fn create_class_scope(&self, class: &Entity) -> Entity {
443 ClassScope::new(&self.0.arena, class).into()
444 }
445
446 pub fn create_enum_scope(&self, class: &Entity) -> Entity {
447 EnumScope::new(&self.0.arena, class).into()
448 }
449
450 pub fn create_interface_scope(&self, itrfc: &Entity) -> Entity {
451 InterfaceScope::new(&self.0.arena, itrfc).into()
452 }
453
454 pub fn create_package_scope(&self, pckg: &Entity) -> Entity {
455 PackageScope::new(&self.0.arena, pckg).into()
456 }
457
458 pub fn create_value(&self, static_type: &Entity) -> Entity {
459 Value::new(&self.0.arena, static_type).into()
460 }
461
462 pub fn create_package_property_import(&self, property: &Entity, location: Option<Location>) -> Entity {
463 PackagePropertyImport::new(&self.0.arena, property, location, &self.0.any_type()).into()
464 }
465
466 pub fn create_package_wildcard_import(&self, package: &Entity, location: Option<Location>) -> Entity {
467 PackageWildcardImport::new(&self.0.arena, package, location, &self.0.any_type()).into()
468 }
469
470 pub fn create_package_recursive_import(&self, package: &Entity, location: Option<Location>) -> Entity {
471 PackageRecursiveImport::new(&self.0.arena, package, location, &self.0.any_type()).into()
472 }
473
474 pub fn create_undefined_constant(&self, static_type: &Entity) -> Entity {
475 UndefinedConstant::new(&self.0.arena, static_type).into()
476 }
477
478 pub fn create_null_constant(&self, static_type: &Entity) -> Entity {
479 NullConstant::new(&self.0.arena, static_type).into()
480 }
481
482 pub fn create_namespace_constant(&self, referenced_ns: &Entity) -> Result<Entity, DeferError> {
483 if referenced_ns.is::<NamespaceConstant>() {
484 return Ok(referenced_ns.clone());
485 }
486 Ok(NamespaceConstant::new(&self.0.arena, referenced_ns, &self.0.namespace_type().defer()?).into())
487 }
488
489 pub(crate) fn create_namespace_constant_with_static_type(&self, referenced_ns: &Entity, static_type: &Entity) -> Entity {
490 NamespaceConstant::new(&self.0.arena, referenced_ns, static_type).into()
491 }
492
493 pub fn create_type_constant(&self, referenced_type: &Entity) -> Result<Entity, DeferError> {
494 Ok(TypeConstant::new(&self.0.arena, referenced_type, &self.0.class_type().defer()?).into())
495 }
496
497 pub(crate) fn create_type_constant_with_static_type(&self, referenced_type: &Entity, static_type: &Entity) -> Entity {
498 TypeConstant::new(&self.0.arena, referenced_type, static_type).into()
499 }
500
501 pub fn create_number_constant(&self, value: Number, static_type: &Entity) -> Entity {
502 NumberConstant::new(&self.0.arena, value, static_type).into()
503 }
504
505 pub fn create_string_constant(&self, value: String, static_type: &Entity) -> Entity {
506 StringConstant::new(&self.0.arena, value, static_type).into()
507 }
508
509 pub fn create_boolean_constant(&self, value: bool, static_type: &Entity) -> Entity {
510 BooleanConstant::new(&self.0.arena, value, static_type).into()
511 }
512
513 pub fn create_this_object(&self, static_type: &Entity) -> Entity {
514 ThisObject::new(&self.0.arena, static_type).into()
515 }
516
517 pub fn create_xml_reference_value(&self, base: &Entity, qualifier: Option<Entity>, key: &Entity) -> Entity {
518 XmlReferenceValue::new(&self.0.arena, base, qualifier, key, &self.0.any_type()).into()
519 }
520
521 pub fn create_dynamic_reference_value(&self, base: &Entity, qualifier: Option<Entity>, key: &Entity) -> Entity {
522 DynamicReferenceValue::new(&self.0.arena, base, qualifier, key, &self.0.any_type()).into()
523 }
524
525 pub fn create_array_element_reference_value(&self, base: &Entity, key: &Entity) -> Result<Entity, DeferError> {
526 let st = base.static_type(self.0).defer()?.escape_of_non_nullable().array_element_type(self.0)?.unwrap();
527 Ok(ArrayElementReferenceValue::new(&self.0.arena, base, key, &st).into())
528 }
529
530 pub fn create_vector_element_reference_value(&self, base: &Entity, key: &Entity) -> Result<Entity, DeferError> {
531 let st = base.static_type(self.0).defer()?.escape_of_non_nullable().vector_element_type(self.0)?.unwrap();
532 Ok(VectorElementReferenceValue::new(&self.0.arena, base, key, &st).into())
533 }
534
535 pub fn create_byte_array_element_reference_value(&self, base: &Entity, key: &Entity) -> Result<Entity, DeferError> {
536 let st = self.0.uint_type().defer()?;
537 Ok(ByteArrayElementReferenceValue::new(&self.0.arena, base, key, &st).into())
538 }
539
540 pub fn create_static_reference_value(&self, base: &Entity, property: &Entity) -> Result<Entity, DeferError> {
541 Ok(StaticReferenceValue::new(&self.0.arena, base, property, &property.property_static_type(self.0).defer()?).into())
542 }
543
544 pub fn create_static_dynamic_reference_value(&self, base: &Entity, qualifier: Option<Entity>, key: &Entity) -> Entity {
545 StaticDynamicReferenceValue::new(&self.0.arena, base, qualifier, key, &self.0.any_type()).into()
546 }
547
548 pub fn create_instance_reference_value(&self, base: &Entity, property: &Entity) -> Result<Entity, DeferError> {
549 Ok(InstanceReferenceValue::new(&self.0.arena, base, property, &property.property_static_type(self.0).defer()?).into())
550 }
551
552 pub fn create_tuple_reference_value(&self, base: &Entity, index: usize) -> Entity {
553 let st = base.static_type(self.0).element_types().get(index).unwrap();
554 TupleReferenceValue::new(&self.0.arena, base, index, &st).into()
555 }
556
557 pub fn create_scope_reference_value(&self, base: &Entity, property: &Entity) -> Result<Entity, DeferError> {
558 Ok(ScopeReferenceValue::new(&self.0.arena, base, property, &property.property_static_type(self.0).defer()?).into())
559 }
560
561 pub fn create_dynamic_scope_reference_value(&self, base: &Entity, qualifier: Option<Entity>, key: &Entity) -> Entity {
562 DynamicScopeReferenceValue::new(&self.0.arena, base, qualifier, key, &self.0.any_type()).into()
563 }
564
565 pub fn create_package_reference_value(&self, base: &Entity, property: &Entity) -> Result<Entity, DeferError> {
566 Ok(PackageReferenceValue::new(&self.0.arena, base, property, &property.property_static_type(self.0).defer()?).into())
567 }
568
569 pub fn create_conversion_value(&self, base: &Entity, variant: ConversionKind, opt: bool, target: &Entity) -> Result<Entity, DeferError> {
570 let mut st = if opt && !target.includes_null(self.0)? {
571 if target.is::<NonNullableType>() {
572 target.base()
573 } else {
574 self.create_nullable_type(target)
575 }
576 } else { target.clone() };
577 if opt && !st.includes_null(self.0)? {
578 st = self.create_nullable_type(target);
579 }
580 Ok(ConversionValue::new(&self.0.arena, base, variant, opt, target, &st).into())
581 }
582
583 pub fn create_non_null_value(&self, base: &Entity) -> Result<Entity, DeferError> {
584 let orig_st = base.static_type(self.0).defer()?;
585 let orig_st_esc = orig_st.escape_of_nullable();
586 if orig_st_esc.includes_null(self.0)? || orig_st_esc.includes_undefined(self.0)? {
587 let st = self.create_non_nullable_type(&orig_st_esc);
588 Ok(NonNullValue::new(&self.0.arena, base, &st).into())
589 } else if orig_st_esc != orig_st {
590 Ok(NonNullValue::new(&self.0.arena, base, &orig_st_esc).into())
591 } else {
592 Ok(base.clone())
593 }
594 }
595
596 pub fn create_lambda_object(&self, activation: &Entity) -> Result<Entity, DeferError> {
597 Ok(LambdaObject::new(&self.0.arena, activation, &self.0.function_type().defer()?).into())
598 }
599
600 pub fn create_filter_value(&self, scope: &Entity, static_type: &Entity) -> Entity {
601 FilterValue::new(&self.0.arena, scope, static_type).into()
602 }
603
604 pub fn create_field_resolution(&self) -> Entity {
605 FieldResolution::new(&self.0.arena).into()
606 }
607
608 pub fn create_declarative_field_destructuring_resolution(&self) -> Entity {
609 DeclarativeFieldDestructuringResolution::new(&self.0.arena).into()
610 }
611
612 pub fn create_assignment_field_destructuring_resolution(&self) -> Entity {
613 AssignmentFieldDestructuringResolution::new(&self.0.arena).into()
614 }
615}