Skip to main content

luaur_analysis/methods/
subtyping_subtyping_subtyping_alt_d.rs

1//! Node: `cxx:Method:Luau.Analysis:Analysis/src/Subtyping.cpp:585:Subtyping`
2//! Source: `Analysis/src/Subtyping.cpp:585-598` (hand-ported)
3
4use crate::records::builtin_types::BuiltinTypes;
5use crate::records::internal_error_reporter::InternalErrorReporter;
6use crate::records::normalizer::Normalizer;
7use crate::records::subtyping::Subtyping;
8use crate::records::type_arena::TypeArena;
9use crate::records::type_check_limits::TypeCheckLimits;
10use crate::records::type_function_runtime::TypeFunctionRuntime;
11use luaur_common::records::dense_hash_map::DenseHashMap;
12
13impl Subtyping {
14    /// C++ `Subtyping::Subtyping(NotNull<BuiltinTypes>, NotNull<TypeArena>,
15    /// NotNull<Normalizer>, NotNull<TypeFunctionRuntime>,
16    /// NotNull<InternalErrorReporter>)` — sets the five collaborators; every
17    /// other member is default-constructed.
18    pub fn subtyping_owned(
19        builtin_types: *mut BuiltinTypes,
20        type_arena: *mut TypeArena,
21        normalizer: *mut Normalizer,
22        type_function_runtime: *mut TypeFunctionRuntime,
23        ice_reporter: *mut InternalErrorReporter,
24    ) -> Self {
25        Subtyping {
26            builtin_types,
27            arena: type_arena,
28            normalizer,
29            type_function_runtime,
30            ice_reporter,
31            limits: TypeCheckLimits::default(),
32            unique_types: core::ptr::null(),
33            seen_types: DenseHashMap::new((core::ptr::null(), core::ptr::null())),
34            seen_packs: DenseHashMap::new((core::ptr::null(), core::ptr::null())),
35            result_cache: DenseHashMap::new((core::ptr::null(), core::ptr::null())),
36        }
37    }
38}