Skip to content

Commit

Permalink
fix(transformer): TODO comments for missing scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jun 23, 2024
1 parent 4bcc86b commit 0c3210c
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 0c3210c

Please sign in to comment.