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(estree/compat): Do not use nightly features #9772

Merged
merged 4 commits into from
Dec 2, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/curvy-icons-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc_estree_compat: patch
swc_core: patch
---

refactor(estree/compat): Do not use nightly features
5 changes: 4 additions & 1 deletion crates/swc_estree_compat/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![deny(clippy::all)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::upper_case_acronyms)]
#![feature(never_type)]

use std::convert::Infallible;

pub mod babelify;
pub mod swcify;

pub type Never = Infallible;
16 changes: 8 additions & 8 deletions crates/swc_estree_compat/src/swcify/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use swc_estree_ast::{
};

use super::Context;
use crate::swcify::Swcify;
use crate::{swcify::Swcify, Never};

impl Swcify for Expression {
type Output = Box<Expr>;
Expand Down Expand Up @@ -819,7 +819,7 @@ impl Swcify for OptionalCallExpression {
}

impl Swcify for TypeCastExpression {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
unimplemented!("flow type cast")
Expand Down Expand Up @@ -1083,47 +1083,47 @@ impl Swcify for swc_estree_ast::JSXClosingFragment {
}

impl Swcify for BindExpression {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
panic!("swc does not support bind expressions")
}
}

impl Swcify for DoExpression {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
panic!("swc does not support do expressions")
}
}

impl Swcify for PipelinePrimaryTopicReference {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
panic!("swc does not support `PipelinePrimaryTopicReference`")
}
}

impl Swcify for RecordExpression {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
panic!("swc does not support record expressions")
}
}

impl Swcify for TupleExpression {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
panic!("swc does not support tuple expressions")
}
}

impl Swcify for ModuleExpression {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
panic!("swc does not support module expressions")
Expand Down
4 changes: 2 additions & 2 deletions crates/swc_estree_compat/src/swcify/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use swc_estree_ast::{
};

use super::Context;
use crate::swcify::Swcify;
use crate::{swcify::Swcify, Never};

impl Swcify for TSTypeParameterInstantiation {
type Output = TsTypeParamInstantiation;
Expand All @@ -23,7 +23,7 @@ impl Swcify for TSTypeParameterInstantiation {
}

impl Swcify for FlowType {
type Output = !;
type Output = Never;

fn swcify(self, _: &Context) -> Self::Output {
unreachable!("swc does not support flow types")
Expand Down
Loading