Skip to content

Commit

Permalink
refactor(transformer): remove no-op scopes code
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed May 8, 2024
1 parent 7113e85 commit 2a88696
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
6 changes: 1 addition & 5 deletions crates/oxc_transformer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions crates/oxc_transformer/src/typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>) {
Expand Down

0 comments on commit 2a88696

Please sign in to comment.