@@ -2260,8 +2260,14 @@ impl<'ctx> ByteCompiler<'ctx> {
22602260 }
22612261
22622262 // Add resource to disposal stack
2263+ #[ cfg( feature = "experimental" ) ]
22632264 self . bytecode . emit_add_disposable_resource ( value. variable ( ) ) ;
22642265
2266+ #[ cfg( not( feature = "experimental" ) ) ]
2267+ self . emit_type_error (
2268+ "using declarations require the 'experimental' feature" ,
2269+ ) ;
2270+
22652271 self . emit_binding ( BindingOpcode :: InitLexical , ident, & value) ;
22662272 self . register_allocator . dealloc ( value) ;
22672273 }
@@ -2275,8 +2281,14 @@ impl<'ctx> ByteCompiler<'ctx> {
22752281 }
22762282
22772283 // Add resource to disposal stack
2284+ #[ cfg( feature = "experimental" ) ]
22782285 self . bytecode . emit_add_disposable_resource ( value. variable ( ) ) ;
22792286
2287+ #[ cfg( not( feature = "experimental" ) ) ]
2288+ self . emit_type_error (
2289+ "using declarations require the 'experimental' feature" ,
2290+ ) ;
2291+
22802292 self . compile_declaration_pattern (
22812293 pattern,
22822294 BindingOpcode :: InitLexical ,
@@ -2300,9 +2312,11 @@ impl<'ctx> ByteCompiler<'ctx> {
23002312 self . bytecode . emit_store_undefined ( value. variable ( ) ) ;
23012313 }
23022314
2303- // TODO: Add resource to async disposal stack
2304- // For now, we just bind the variable like a let declaration
2305- // Full implementation will add: AddAsyncDisposableResource opcode
2315+ // await using is not yet implemented even under experimental
2316+ #[ cfg( not( feature = "experimental" ) ) ]
2317+ self . emit_type_error (
2318+ "await using declarations require the 'experimental' feature" ,
2319+ ) ;
23062320
23072321 self . emit_binding ( BindingOpcode :: InitLexical , ident, & value) ;
23082322 self . register_allocator . dealloc ( value) ;
@@ -2316,7 +2330,12 @@ impl<'ctx> ByteCompiler<'ctx> {
23162330 self . bytecode . emit_store_undefined ( value. variable ( ) ) ;
23172331 }
23182332
2319- // TODO: SAME
2333+ // await using is not yet implemented even under experimental
2334+ #[ cfg( not( feature = "experimental" ) ) ]
2335+ self . emit_type_error (
2336+ "await using declarations require the 'experimental' feature" ,
2337+ ) ;
2338+
23202339 self . compile_declaration_pattern (
23212340 pattern,
23222341 BindingOpcode :: InitLexical ,
0 commit comments