Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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