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

fix(transformer): TODO comments for missing scopes #3837

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ impl<'a> TypeScriptAnnotations<'a> {
if !self.assignments.is_empty() {
if let Statement::ExpressionStatement(expr) = &stmt.consequent {
if expr.expression.is_super_call_expression() {
// TODO: Need to create a scope for this block
stmt.consequent = self.ctx.ast.block_statement(self.ctx.ast.block(
expr.span,
self.ctx.ast.new_vec_single(self.ctx.ast.copy(&stmt.consequent)),
Expand All @@ -386,13 +387,15 @@ impl<'a> TypeScriptAnnotations<'a> {
};
if let Some(span) = alternate_span {
let alternate = stmt.alternate.take().unwrap();
// TODO: Need to create a scope for this block
stmt.alternate = Some(self.ctx.ast.block_statement(
self.ctx.ast.block(span, self.ctx.ast.new_vec_single(alternate)),
));
}
}

if stmt.consequent.is_typescript_syntax() {
// TODO: Need to create a scope for this block
stmt.consequent = self.ctx.ast.block_statement(
self.ctx.ast.block(stmt.consequent.span(), self.ctx.ast.new_vec()),
);
Expand All @@ -405,6 +408,7 @@ impl<'a> TypeScriptAnnotations<'a> {

pub fn transform_for_statement(&mut self, stmt: &mut ForStatement<'a>) {
if stmt.body.is_typescript_syntax() {
// TODO: Need to create a scope for this block
stmt.body = self
.ctx
.ast
Expand All @@ -414,6 +418,7 @@ impl<'a> TypeScriptAnnotations<'a> {

pub fn transform_while_statement(&mut self, stmt: &mut WhileStatement<'a>) {
if stmt.body.is_typescript_syntax() {
// TODO: Need to create a scope for this block
stmt.body = self
.ctx
.ast
Expand All @@ -423,6 +428,7 @@ impl<'a> TypeScriptAnnotations<'a> {

pub fn transform_do_while_statement(&mut self, stmt: &mut DoWhileStatement<'a>) {
if stmt.body.is_typescript_syntax() {
// TODO: Need to create a scope for this block
stmt.body = self
.ctx
.ast
Expand Down
Loading