Skip to content

Commit

Permalink
chore: merge stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Apr 18, 2024
1 parent a0ae9cc commit 9736d4d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::context::Ctx;
use crate::TypeScriptOptions;

use oxc_allocator::Vec;
use oxc_ast::ast::*;
use oxc_ast::{ast::*, dummy};
use oxc_span::{Atom, SPAN};
use oxc_syntax::operator::AssignmentOperator;
use rustc_hash::FxHashSet;
Expand Down Expand Up @@ -83,7 +83,9 @@ impl<'a> TypeScriptAnnotations<'a> {
ModuleDeclaration::ExportNamedDeclaration(decl) => {
decl.specifiers.retain(|specifier| {
!(specifier.export_kind.is_type()
|| import_type_names.contains(specifier.exported.name()))
|| import_type_names.contains(
specifier.exported.name().unwrap_or_else(|| dummy!(panic)),
))
});

decl.export_kind.is_type()
Expand Down Expand Up @@ -136,6 +138,7 @@ impl<'a> TypeScriptAnnotations<'a> {

references.has_reference(&s.local.name)
}
ImportDeclarationSpecifier::Dummy => dummy!(panic),
});
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/typescript/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<'a> TypeScriptReferenceCollector<'a> {

for specifier in &decl.specifiers {
if specifier.export_kind.is_value() {
self.names.insert(specifier.local.name().clone());
self.names.insert(specifier.local.as_atom());
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion crates/oxc_transformer/src/typescript/enum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::mem;

use oxc_allocator::{Box, Vec};
use oxc_ast::ast::*;
use oxc_ast::{ast::*, dummy};
use oxc_span::{Atom, SPAN};
use oxc_syntax::{
operator::{AssignmentOperator, BinaryOperator, LogicalOperator},
Expand Down Expand Up @@ -115,6 +115,7 @@ impl<'a> TypeScript<'a> {
TSEnumMemberName::StringLiteral(str) => (&str.value, str.span),
TSEnumMemberName::ComputedPropertyName(..)
| TSEnumMemberName::NumericLiteral(..) => unreachable!(),
TSEnumMemberName::Dummy => dummy!(panic),
};

let mut init = self
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_transformer/src/typescript/module.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use oxc_allocator::Box;
use oxc_ast::ast::*;
use oxc_ast::{ast::*, dummy};
use oxc_span::SPAN;

use super::TypeScript;
Expand All @@ -19,6 +19,7 @@ impl<'a> TypeScript<'a> {
qualified_name.right.clone(),
false,
),
TSTypeName::Dummy => dummy!(panic),
}
}

Expand Down Expand Up @@ -51,6 +52,7 @@ impl<'a> TypeScript<'a> {
));
self.ctx.ast.call_expression(SPAN, callee, arguments, false, None)
}
TSModuleReference::Dummy => dummy!(panic),
};
self.ctx.ast.new_vec_single(self.ctx.ast.variable_declarator(
SPAN,
Expand Down

0 comments on commit 9736d4d

Please sign in to comment.