Skip to main content

Frontend

Struct Frontend 

Source
pub struct Frontend {
Show 20 fields pub use_new_luau_solver: AtomicI32, pub environments: HashMap<String, ScopePtr>, pub builtin_definitions: HashMap<String, Rc<dyn Fn(&mut Frontend, &mut GlobalTypes, ScopePtr)>>, pub builtin_types_: BuiltinTypes, pub builtin_types: *mut BuiltinTypes, pub file_resolver: *mut FileResolver, pub module_resolver: FrontendModuleResolver, pub module_resolver_for_autocomplete: FrontendModuleResolver, pub globals: GlobalTypes, pub globals_for_autocomplete: GlobalTypes, pub config_resolver: *mut ConfigResolver, pub options: FrontendOptions, pub ice_handler: InternalErrorReporter, pub prepare_module_scope: Option<Rc<dyn Fn(&ModuleName, &ScopePtr, bool)>>, pub write_json_log: Option<Rc<dyn Fn(&ModuleName, String)>>, pub source_nodes: HashMap<ModuleName, Arc<SourceNode>>, pub source_modules: HashMap<ModuleName, Arc<SourceModule>>, pub require_trace: HashMap<ModuleName, RequireTraceResult>, pub stats: FrontendStats, pub module_queue: Vec<ModuleName>,
}

Fields§

§use_new_luau_solver: AtomicI32§environments: HashMap<String, ScopePtr>§builtin_definitions: HashMap<String, Rc<dyn Fn(&mut Frontend, &mut GlobalTypes, ScopePtr)>>§builtin_types_: BuiltinTypes§builtin_types: *mut BuiltinTypes§file_resolver: *mut FileResolver§module_resolver: FrontendModuleResolver§module_resolver_for_autocomplete: FrontendModuleResolver§globals: GlobalTypes§globals_for_autocomplete: GlobalTypes§config_resolver: *mut ConfigResolver§options: FrontendOptions§ice_handler: InternalErrorReporter§prepare_module_scope: Option<Rc<dyn Fn(&ModuleName, &ScopePtr, bool)>>§write_json_log: Option<Rc<dyn Fn(&ModuleName, String)>>§source_nodes: HashMap<ModuleName, Arc<SourceNode>>§source_modules: HashMap<ModuleName, Arc<SourceModule>>§require_trace: HashMap<ModuleName, RequireTraceResult>§stats: FrontendStats§module_queue: Vec<ModuleName>

Implementations§

Source§

impl Frontend

Source

pub fn add_build_queue_items( &mut self, items: &mut Vec<BuildQueueItem>, build_queue: &Vec<ModuleName>, cycle_detected: bool, seen: &mut DenseHashSet<ModuleName>, frontend_options: &FrontendOptions, )

Source§

impl Frontend

Source

pub fn add_environment(&mut self, environment_name: String) -> ScopePtr

Source§

impl Frontend

Source

pub fn all_module_dependencies_valid( &self, name: &ModuleName, for_autocomplete: bool, ) -> bool

Source§

impl Frontend

Source

pub fn apply_builtin_definition_to_environment( &mut self, environment_name: String, definition_name: String, )

Source§

impl Frontend

Source

pub fn check_build_queue_item(&mut self, item: &mut BuildQueueItem)

Source§

impl Frontend

Source

pub fn check_build_queue_items(&mut self, items: &mut Vec<BuildQueueItem>)

Source§

impl Frontend

Source§

impl Frontend

Source

pub fn check_source_module_mode_vector_require_cycle_optional_scope_ptr_bool_bool_frontend_stats_type_check_limits( &mut self, source_module: &SourceModule, mode: Mode, require_cycles: Vec<RequireCycle>, environment_scope: Option<ScopePtr>, for_autocomplete: bool, record_json_log: bool, stats: &mut FrontendStats, type_check_limits: TypeCheckLimits, ) -> ModulePtr

Source§

impl Frontend

Source

pub fn check_queued_modules( &mut self, option_override: Option<FrontendOptions>, execute_tasks: Box<dyn Fn(Vec<Box<dyn Fn()>>)>, progress: Box<dyn Fn(usize, usize) -> bool>, ) -> Vec<ModuleName>

Source§

impl Frontend

Source

pub fn classify_lints( &self, warnings: &Vec<LintWarning>, config: &Config, ) -> LintResult

Source§

impl Frontend

Source

pub fn clear(&mut self)

Source§

impl Frontend

Source§

impl Frontend

Source

pub fn clear_stats(&mut self)

Source§

impl Frontend

Source

pub fn frontend_solver_mode_file_resolver_config_resolver_frontend_options( mode: SolverMode, file_resolver: *mut FileResolver, config_resolver: *mut ConfigResolver, options: FrontendOptions, ) -> Self

Owned constructor for Frontend::Frontend(SolverMode, FileResolver*, ConfigResolver*, FrontendOptions).

The C++ member-init list wires several self-referential pointers: builtinTypes(NotNull{&builtinTypes_}), moduleResolver(this), moduleResolverForAutocomplete(this), and the two GlobalTypes members capture builtinTypes (i.e. &builtinTypes_). None of those can be set here because the returned value is moved into its final slot, so they are left null/dangling-free and wired by Frontend::wire_self_pointers once the Frontend lives at a stable address.

builtinTypes_’s arena is heap-boxed, so moving the BuiltinTypes value itself is sound; GlobalTypes::new runs its arena mutations through the temporary &builtinTypes_ pointer (valid for the duration of this call), and only the cached builtin_types back-pointer is re-pointed afterward.

Source

pub unsafe fn wire_self_pointers(&mut self)

Wires the self-referential pointers the C++ Frontend member-init list sets in place: builtinTypes(&builtinTypes_), the two GlobalTypes’ captured builtinTypes, and moduleResolver(this) / moduleResolverForAutocomplete(this).

Must be called once the Frontend is at its final address and before any use of builtin_types, globals.builtin_types, or the module resolvers.

§Safety

The Frontend must not be moved after this call, or the wired pointers dangle.

Source§

impl Frontend

Source

pub fn frontend_file_resolver_config_resolver_frontend_options( file_resolver: *mut FileResolver, config_resolver: *mut ConfigResolver, options: &FrontendOptions, ) -> Self

Owned constructor delegating to the SolverMode-taking ctor. The only difference from C++ ctor #1 is the solver mode is derived from the LuauSolverV2 fast flag: useNewLuauSolver(FFlag::LuauSolverV2 ? SolverMode::New : SolverMode::Old).

As with the other ctor, the returned value’s self-referential pointers are wired by Frontend::wire_self_pointers after placement.

Source§

impl Frontend

Source

pub fn get_check_result( &self, name: &ModuleName, accumulate_nested: bool, for_autocomplete: bool, ) -> Option<CheckResult>

Source§

impl Frontend

Source

pub fn get_environment_scope(&self, environment_name: String) -> ScopePtr

Source§

impl Frontend

Source§

impl Frontend

Source

pub fn get_module_environment( &self, module: &SourceModule, config: &Config, for_autocomplete: bool, ) -> ScopePtr

Source§

impl Frontend

Source

pub fn get_required_scripts( &mut self, name: &ModuleName, limits: &TypeCheckLimits, ) -> Vec<ModuleName>

Source§

impl Frontend

Source

pub fn get_source_module_mut( &mut self, module_name: &ModuleName, ) -> *mut SourceModule

Source§

impl Frontend

Source§

impl Frontend

Source§

impl Frontend

Source

pub fn is_dirty(&self, name: &ModuleName, for_autocomplete: bool) -> bool

Source§

impl Frontend

Source

pub fn load_definition_file( &mut self, globals: &mut GlobalTypes, target_scope: ScopePtr, source: &str, package_name: String, capture_comments: bool, _type_check_for_autocomplete: bool, ) -> LoadDefinitionFileResult

Source§

impl Frontend

Source

pub fn mark_dirty( &mut self, name: &ModuleName, marked_dirty: Option<&mut Vec<ModuleName>>, )

Source§

impl Frontend

Source

pub fn parse_module_name(&mut self, name: &ModuleName)

Source§

impl Frontend

Source

pub fn parse_module_name_string_view_parse_options( &mut self, name: &ModuleName, src: &str, parse_options: &ParseOptions, ) -> SourceModule

Source§

impl Frontend

Source

pub fn parse_graph( &mut self, build_queue: &mut Vec<ModuleName>, root: &ModuleName, limits: &TypeCheckLimits, for_autocomplete: bool, ) -> bool

Source§

impl Frontend

Source

pub fn parse_modules(&mut self, names: &Vec<ModuleName>)

Source§

impl Frontend

Source

pub fn parse_type( &mut self, allocator: &mut Allocator, name_table: &mut AstNameTable, ice_handler: &mut InternalErrorReporter, limits: TypeCheckLimits, arena: &mut TypeArena, source: &str, ) -> TypeId

Source§

impl Frontend

Source

pub fn perform_queue_item_task( &mut self, state: Arc<BuildQueueWorkState>, item_pos: usize, )

Source§

impl Frontend

Source

pub fn populate_expected_types( &self, source_module: &SourceModule, module: *mut Module, root_scope: &ScopePtr, )

Source§

impl Frontend

Source§

impl Frontend

Source§

impl Frontend

Source

pub fn record_item_result(&mut self, item: &BuildQueueItem)

Source§

impl Frontend

Source

pub fn register_builtin_definition( &mut self, name: String, applicator: Box<dyn Fn(&mut Frontend, &mut GlobalTypes, ScopePtr)>, )

Source§

impl Frontend

Source§

impl Frontend

Source

pub fn send_queue_item_tasks( &mut self, state: Arc<BuildQueueWorkState>, items: Vec<usize>, )

Source§

impl Frontend

Source

pub fn set_luau_solver_mode(&mut self, mode: SolverMode)

Source§

impl Frontend

Source

pub fn traverse_dependents( &mut self, name: &ModuleName, process_subtree: Box<dyn Fn(&mut SourceNode) -> bool>, )

Trait Implementations§

Source§

impl Debug for Frontend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.