@@ -122,6 +122,7 @@ pub enum ChunkMode {
122122pub struct Compiler {
123123 optimization_level : u8 ,
124124 debug_level : u8 ,
125+ type_info_level : u8 ,
125126 coverage_level : u8 ,
126127 vector_lib : Option < String > ,
127128 vector_ctor : Option < String > ,
@@ -144,6 +145,7 @@ impl Compiler {
144145 Compiler {
145146 optimization_level : 1 ,
146147 debug_level : 1 ,
148+ type_info_level : 0 ,
147149 coverage_level : 0 ,
148150 vector_lib : None ,
149151 vector_ctor : None ,
@@ -176,6 +178,16 @@ impl Compiler {
176178 self
177179 }
178180
181+ /// Sets Luau type information level used to guide native code generation decisions.
182+ ///
183+ /// Possible values:
184+ /// * 0 - generate for native modules (default)
185+ /// * 1 - generate for all modules
186+ pub const fn set_type_info_level ( mut self , level : u8 ) -> Self {
187+ self . type_info_level = level;
188+ self
189+ }
190+
179191 /// Sets Luau compiler code coverage level.
180192 ///
181193 /// Possible values:
@@ -250,15 +262,15 @@ impl Compiler {
250262 }
251263
252264 unsafe {
253- let options = ffi:: lua_CompileOptions {
254- optimizationLevel : self . optimization_level as c_int ,
255- debugLevel : self . debug_level as c_int ,
256- coverageLevel : self . coverage_level as c_int ,
257- vectorLib : vector_lib . map_or ( ptr :: null ( ) , |s| s . as_ptr ( ) ) ,
258- vectorCtor : vector_ctor . map_or ( ptr:: null ( ) , |s| s. as_ptr ( ) ) ,
259- vectorType : vector_type . map_or ( ptr:: null ( ) , |s| s. as_ptr ( ) ) ,
260- mutableGlobals : mutable_globals_ptr ,
261- } ;
265+ let mut options = ffi:: lua_CompileOptions:: default ( ) ;
266+ options . optimizationLevel = self . optimization_level as c_int ;
267+ options . debugLevel = self . debug_level as c_int ;
268+ options . typeInfoLevel = self . type_info_level as c_int ;
269+ options . coverageLevel = self . coverage_level as c_int ;
270+ options . vectorLib = vector_lib . map_or ( ptr:: null ( ) , |s| s. as_ptr ( ) ) ;
271+ options . vectorCtor = vector_ctor . map_or ( ptr:: null ( ) , |s| s. as_ptr ( ) ) ;
272+ options . vectorType = vector_type . map_or ( ptr :: null ( ) , |s| s . as_ptr ( ) ) ;
273+ options . mutableGlobals = mutable_globals_ptr ;
262274 ffi:: luau_compile ( source. as_ref ( ) , options)
263275 }
264276 }
0 commit comments