@@ -122,6 +122,7 @@ pub enum ChunkMode {
122
122
pub struct Compiler {
123
123
optimization_level : u8 ,
124
124
debug_level : u8 ,
125
+ type_info_level : u8 ,
125
126
coverage_level : u8 ,
126
127
vector_lib : Option < String > ,
127
128
vector_ctor : Option < String > ,
@@ -144,6 +145,7 @@ impl Compiler {
144
145
Compiler {
145
146
optimization_level : 1 ,
146
147
debug_level : 1 ,
148
+ type_info_level : 0 ,
147
149
coverage_level : 0 ,
148
150
vector_lib : None ,
149
151
vector_ctor : None ,
@@ -176,6 +178,16 @@ impl Compiler {
176
178
self
177
179
}
178
180
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
+
179
191
/// Sets Luau compiler code coverage level.
180
192
///
181
193
/// Possible values:
@@ -250,15 +262,15 @@ impl Compiler {
250
262
}
251
263
252
264
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 ;
262
274
ffi:: luau_compile ( source. as_ref ( ) , options)
263
275
}
264
276
}
0 commit comments