refactor(transformer): remove no-op scopes code (#3210)

Remove some code from the transformer which doesn't do anything.
This commit is contained in:
overlookmotel 2024-05-09 12:40:48 +01:00 committed by GitHub
parent 0ba7778e5e
commit 952565329b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 10 deletions

View file

@ -28,7 +28,6 @@ use oxc_allocator::{Allocator, Vec};
use oxc_ast::{ast::*, Trivias};
use oxc_diagnostics::Error;
use oxc_span::SourceType;
// use oxc_syntax::scope::ScopeFlags;
use oxc_traverse::{traverse_mut, Traverse, TraverseCtx};
pub use crate::{
@ -156,10 +155,7 @@ impl<'a> Traverse<'a> for Transformer<'a> {
}
fn enter_function(&mut self, func: &mut Function<'a>, _ctx: &TraverseCtx<'a>) {
// TODO: Scope flags
// Was a function param: flags: Option<ScopeFlags>,
let flags = None;
self.x0_typescript.transform_function(func, flags);
self.x0_typescript.transform_function(func);
}
fn enter_jsx_opening_element(

View file

@ -8,7 +8,7 @@ use crate::TypeScriptOptions;
use oxc_allocator::Vec;
use oxc_ast::ast::*;
use oxc_span::{Atom, SPAN};
use oxc_syntax::{operator::AssignmentOperator, scope::ScopeFlags};
use oxc_syntax::operator::AssignmentOperator;
use rustc_hash::FxHashSet;
use super::collector::TypeScriptReferenceCollector;
@ -217,7 +217,7 @@ impl<'a> TypeScriptAnnotations<'a> {
param.accessibility = None;
}
pub fn transform_function(&mut self, func: &mut Function<'a>, _flags: Option<ScopeFlags>) {
pub fn transform_function(&mut self, func: &mut Function<'a>) {
func.this_param = None;
func.type_parameters = None;
func.return_type = None;

View file

@ -11,7 +11,6 @@ use serde::Deserialize;
use oxc_allocator::Vec;
use oxc_ast::ast::*;
use oxc_syntax::scope::ScopeFlags;
use oxc_traverse::TraverseCtx;
use crate::context::Ctx;
@ -116,8 +115,8 @@ impl<'a> TypeScript<'a> {
self.annotations.transform_formal_parameter(param);
}
pub fn transform_function(&mut self, func: &mut Function<'a>, flags: Option<ScopeFlags>) {
self.annotations.transform_function(func, flags);
pub fn transform_function(&mut self, func: &mut Function<'a>) {
self.annotations.transform_function(func);
}
pub fn transform_jsx_opening_element(&mut self, elem: &mut JSXOpeningElement<'a>) {