@@ -9,7 +9,6 @@ use std::{
99
1010use serde:: Deserialize ;
1111
12- use oxc_ast:: ast:: { BindingPatternKind , Declaration , Statement , VariableDeclarationKind } ;
1312use oxc_index:: { IndexVec , define_index_type} ;
1413
1514use crate :: {
@@ -188,7 +187,9 @@ fn generate(codegen: &Codegen) -> Codes {
188187 let mut walk = string ! ( "
189188 export { walkProgram }
190189
190+ /* IF ANCESTORS */
191191 export const ancestors = [];
192+ /* END_IF */
192193
193194 const { isArray } = Array;
194195
@@ -346,35 +347,6 @@ fn generate(codegen: &Codegen) -> Codes {
346347 struct WalkVariantGenerator ;
347348 impl VariantGenerator < 1 > for WalkVariantGenerator {
348349 const FLAG_NAMES : [ & str ; 1 ] = [ "ANCESTORS" ] ;
349-
350- // Remove extraneous `export const ancestors = [];` statement from parser version
351- fn pre_process_variant < ' a > (
352- & self ,
353- program : & mut oxc_ast:: ast:: Program < ' a > ,
354- flags : [ bool ; 1 ] ,
355- _allocator : & ' a oxc_allocator:: Allocator ,
356- ) {
357- if flags[ 0 ] {
358- return ;
359- }
360-
361- let stmt_index = program. body . iter ( ) . position ( |stmt| {
362- if let Statement :: ExportNamedDeclaration ( decl) = stmt
363- && let Some ( Declaration :: VariableDeclaration ( decl) ) = & decl. declaration
364- && decl. kind == VariableDeclarationKind :: Const
365- && decl. declarations . len ( ) == 1
366- && let BindingPatternKind :: BindingIdentifier ( ident) =
367- & decl. declarations [ 0 ] . id . kind
368- && ident. name == "ancestors"
369- {
370- true
371- } else {
372- false
373- }
374- } ) ;
375- let stmt_index = stmt_index. unwrap ( ) ;
376- program. body . remove ( stmt_index) ;
377- }
378350 }
379351
380352 let mut walk_variants = WalkVariantGenerator . generate ( & walk) . into_iter ( ) ;
0 commit comments