mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
build(cargo): Update rustc
to 2023-07-03
(#7623)
This commit is contained in:
parent
40ee26b2c9
commit
b34f1adbcc
4
bindings/Cargo.lock
generated
4
bindings/Cargo.lock
generated
@ -2110,9 +2110,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.56"
|
||||
version = "1.0.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
|
||||
checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -250,12 +250,12 @@ where
|
||||
|
||||
c.arg("-e");
|
||||
c.arg(
|
||||
r###"
|
||||
r#"
|
||||
function looseJsonParse(obj) {
|
||||
return Function('"use strict";return (' + obj + ")")();
|
||||
}
|
||||
console.log(JSON.stringify(looseJsonParse(process.argv[1])));
|
||||
"###,
|
||||
"#,
|
||||
);
|
||||
|
||||
c.arg(s);
|
||||
|
@ -671,7 +671,7 @@ impl Options {
|
||||
// Embedded runtime plugin target, based on assumption we have
|
||||
// 1. filesystem access for the cache
|
||||
// 2. embedded runtime can compiles & execute wasm
|
||||
#[cfg(all(any(feature = "plugin"), not(target_arch = "wasm32")))]
|
||||
#[cfg(all(feature = "plugin", not(target_arch = "wasm32")))]
|
||||
{
|
||||
use swc_ecma_loader::resolve::Resolve;
|
||||
|
||||
@ -730,7 +730,7 @@ impl Options {
|
||||
// 1. no filesystem access, loading binary / cache management should be
|
||||
// performed externally
|
||||
// 2. native runtime compiles & execute wasm (i.e v8 on node, chrome)
|
||||
#[cfg(all(any(feature = "plugin"), target_arch = "wasm32"))]
|
||||
#[cfg(all(feature = "plugin", target_arch = "wasm32"))]
|
||||
{
|
||||
handler.warn(
|
||||
"Currently @swc/wasm does not support plugins, plugin transform will be \
|
||||
|
@ -7,7 +7,7 @@
|
||||
)]
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(any(feature = "plugin"))]
|
||||
#[cfg(feature = "plugin")]
|
||||
use swc_ecma_ast::*;
|
||||
#[cfg(not(any(feature = "plugin")))]
|
||||
use swc_ecma_transforms::pass::noop;
|
||||
@ -48,7 +48,7 @@ struct RustPlugins {
|
||||
}
|
||||
|
||||
impl RustPlugins {
|
||||
#[cfg(any(feature = "plugin"))]
|
||||
#[cfg(feature = "plugin")]
|
||||
fn apply(&mut self, n: Program) -> Result<Program, anyhow::Error> {
|
||||
use anyhow::Context;
|
||||
if self.plugins.is_none() || self.plugins.as_ref().unwrap().is_empty() {
|
||||
@ -64,7 +64,7 @@ impl RustPlugins {
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "info", skip_all, name = "apply_plugins")]
|
||||
#[cfg(all(any(feature = "plugin"), not(target_arch = "wasm32")))]
|
||||
#[cfg(all(feature = "plugin", not(target_arch = "wasm32")))]
|
||||
fn apply_inner(&mut self, n: Program) -> Result<Program, anyhow::Error> {
|
||||
use anyhow::Context;
|
||||
use swc_common::plugin::serialized::PluginSerializedBytes;
|
||||
@ -145,7 +145,7 @@ impl RustPlugins {
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "plugin"), target_arch = "wasm32"))]
|
||||
#[cfg(all(feature = "plugin", target_arch = "wasm32"))]
|
||||
#[tracing::instrument(level = "info", skip_all)]
|
||||
fn apply_inner(&mut self, n: Program) -> Result<Program, anyhow::Error> {
|
||||
// [TODO]: unimplemented
|
||||
@ -156,14 +156,14 @@ impl RustPlugins {
|
||||
impl Fold for RustPlugins {
|
||||
noop_fold_type!();
|
||||
|
||||
#[cfg(any(feature = "plugin"))]
|
||||
#[cfg(feature = "plugin")]
|
||||
fn fold_module(&mut self, n: Module) -> Module {
|
||||
self.apply(Program::Module(n))
|
||||
.expect("failed to invoke plugin")
|
||||
.expect_module()
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "plugin"))]
|
||||
#[cfg(feature = "plugin")]
|
||||
fn fold_script(&mut self, n: Script) -> Script {
|
||||
self.apply(Program::Script(n))
|
||||
.expect("failed to invoke plugin")
|
||||
|
@ -90,7 +90,7 @@ struct TestUnitData {
|
||||
}
|
||||
|
||||
static OPTION_REGEX: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r#"^[\\/]{2}\s*@(\w+)\s*:\s*([^\r\n]*)"#).unwrap());
|
||||
Lazy::new(|| Regex::new(r"^[\\/]{2}\s*@(\w+)\s*:\s*([^\r\n]*)").unwrap());
|
||||
|
||||
fn matrix(input: &Path) -> Vec<TestUnitData> {
|
||||
let cm = Arc::<SourceMap>::default();
|
||||
|
@ -70,7 +70,7 @@ where
|
||||
unimplemented!("module string names unimplemented")
|
||||
}
|
||||
};
|
||||
if let Some(..) = ctx.transitive_remap.get(&exported.span.ctxt) {
|
||||
if ctx.transitive_remap.get(&exported.span.ctxt).is_some() {
|
||||
let specifier = ExportSpecifier::Named(ExportNamedSpecifier {
|
||||
span: DUMMY_SP,
|
||||
orig: orig.clone(),
|
||||
|
@ -279,14 +279,9 @@ impl Modules {
|
||||
.into_iter(),
|
||||
);
|
||||
|
||||
module.body.extend(
|
||||
cloned
|
||||
.appended_stmts
|
||||
.get(&id)
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
.into_iter(),
|
||||
);
|
||||
module
|
||||
.body
|
||||
.extend(cloned.appended_stmts.get(&id).cloned().unwrap_or_default());
|
||||
|
||||
stmts.extend(module.body);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ pub enum FileName {
|
||||
#[cfg_attr(feature = "rkyv-impl", repr(C))]
|
||||
pub struct EncodePathBuf;
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl rkyv::with::ArchiveWith<PathBuf> for EncodePathBuf {
|
||||
type Archived = rkyv::string::ArchivedString;
|
||||
type Resolver = rkyv::string::StringResolver;
|
||||
@ -176,7 +176,7 @@ impl rkyv::with::ArchiveWith<PathBuf> for EncodePathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl<S> rkyv::with::SerializeWith<PathBuf, S> for EncodePathBuf
|
||||
where
|
||||
S: ?Sized + rkyv::ser::Serializer,
|
||||
@ -188,7 +188,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl<D> rkyv::with::DeserializeWith<rkyv::string::ArchivedString, PathBuf, D> for EncodePathBuf
|
||||
where
|
||||
D: ?Sized + rkyv::Fallible,
|
||||
@ -209,7 +209,7 @@ where
|
||||
#[cfg_attr(feature = "rkyv-impl", repr(C))]
|
||||
pub struct EncodeUrl;
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl rkyv::with::ArchiveWith<Url> for EncodeUrl {
|
||||
type Archived = rkyv::string::ArchivedString;
|
||||
type Resolver = rkyv::string::StringResolver;
|
||||
@ -225,7 +225,7 @@ impl rkyv::with::ArchiveWith<Url> for EncodeUrl {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl<S> rkyv::with::SerializeWith<Url, S> for EncodeUrl
|
||||
where
|
||||
S: ?Sized + rkyv::ser::Serializer,
|
||||
@ -237,7 +237,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl<D> rkyv::with::DeserializeWith<rkyv::Archived<String>, Url, D> for EncodeUrl
|
||||
where
|
||||
D: ?Sized + rkyv::Fallible,
|
||||
@ -575,7 +575,7 @@ impl Span {
|
||||
/// Dummy span, both position are extremely large numbers so they would be
|
||||
/// ignore by sourcemap, but can still have comments
|
||||
pub fn dummy_with_cmt() -> Self {
|
||||
#[cfg(all(any(feature = "__plugin_mode"), target_arch = "wasm32"))]
|
||||
#[cfg(all(feature = "__plugin_mode", target_arch = "wasm32"))]
|
||||
{
|
||||
let lo = BytePos(unsafe { __span_dummy_with_cmt_proxy() });
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#[cfg(any(feature = "quote"))]
|
||||
#[cfg(feature = "quote")]
|
||||
use swc_core::{ast::Ident, common::DUMMY_SP, quote, quote_expr, utils::private_ident};
|
||||
|
||||
#[cfg(any(feature = "quote"))]
|
||||
#[cfg(feature = "quote")]
|
||||
#[test]
|
||||
fn quote_expr_call_1() {
|
||||
let _expr = quote_expr!("call(arg1, typeof arg2, arg3)");
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "quote"))]
|
||||
#[cfg(feature = "quote")]
|
||||
#[test]
|
||||
fn quote_expr_var_cloned() {
|
||||
testing::run_test2(false, |_cm, _handler| {
|
||||
@ -20,7 +20,7 @@ fn quote_expr_var_cloned() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "quote"))]
|
||||
#[cfg(feature = "quote")]
|
||||
#[test]
|
||||
fn quote_example() {
|
||||
let _stmt = quote!(
|
||||
@ -29,7 +29,7 @@ fn quote_example() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "quote"))]
|
||||
#[cfg(feature = "quote")]
|
||||
#[test]
|
||||
fn quote_var_type_expr() {
|
||||
let _stmt = quote!(
|
||||
@ -39,7 +39,7 @@ fn quote_var_type_expr() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "quote"))]
|
||||
#[cfg(feature = "quote")]
|
||||
#[test]
|
||||
fn quote_var_type_pat() {
|
||||
let _stmt = quote!(
|
||||
|
@ -256,7 +256,7 @@ impl Compiler {
|
||||
|
||||
nested_of_media.extend(
|
||||
once(Rule::QualifiedRule(q))
|
||||
.chain(rules.into_iter())
|
||||
.chain(rules)
|
||||
.map(From::from),
|
||||
);
|
||||
}
|
||||
|
@ -504,7 +504,8 @@ impl VisitMut for MediaFeatureResolutionReplacerOnLegacyVariant<'_> {
|
||||
value: feature_name_value,
|
||||
span: feature_name_span,
|
||||
..
|
||||
}) = &n.name else {
|
||||
}) = &n.name
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -169,7 +169,7 @@ pub enum Expr {
|
||||
Invalid(Invalid),
|
||||
}
|
||||
|
||||
// Memory layout depedns on the version of rustc.
|
||||
// Memory layout depends on the version of rustc.
|
||||
// #[cfg(target_pointer_width = "64")]
|
||||
// assert_eq_size!(Expr, [u8; 80]);
|
||||
|
||||
@ -207,7 +207,7 @@ impl Expr {
|
||||
///
|
||||
/// Panics if `exprs` is empty.
|
||||
pub fn from_exprs(mut exprs: Vec<Box<Expr>>) -> Box<Expr> {
|
||||
debug_assert_ne!(exprs, vec![], "exprs must not be empty");
|
||||
debug_assert!(!exprs.is_empty(), "`exprs` must not be empty");
|
||||
|
||||
if exprs.len() == 1 {
|
||||
exprs.remove(0)
|
||||
|
@ -86,7 +86,7 @@ impl EqIgnoreSpan for BigInt {
|
||||
#[cfg_attr(feature = "rkyv-impl", repr(C))]
|
||||
pub struct EncodeBigInt;
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl rkyv::with::ArchiveWith<Box<BigIntValue>> for EncodeBigInt {
|
||||
type Archived = rkyv::Archived<String>;
|
||||
type Resolver = rkyv::Resolver<String>;
|
||||
@ -104,7 +104,7 @@ impl rkyv::with::ArchiveWith<Box<BigIntValue>> for EncodeBigInt {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl<S> rkyv::with::SerializeWith<Box<BigIntValue>, S> for EncodeBigInt
|
||||
where
|
||||
S: ?Sized + rkyv::ser::Serializer,
|
||||
@ -118,7 +118,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "rkyv-impl"))]
|
||||
#[cfg(feature = "rkyv-impl")]
|
||||
impl<D> rkyv::with::DeserializeWith<rkyv::Archived<String>, Box<BigIntValue>, D> for EncodeBigInt
|
||||
where
|
||||
D: ?Sized + rkyv::Fallible,
|
||||
|
@ -116,12 +116,12 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn issue_204_01() {
|
||||
assert_min(r#"'\r\n';"#, r#""\r\n""#);
|
||||
assert_min(r"'\r\n';", r#""\r\n""#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_204_02() {
|
||||
assert_min(r#"const a = fn() + '\r\n';"#, r#"const a=fn()+"\r\n""#);
|
||||
assert_min(r"const a = fn() + '\r\n';", r#"const a=fn()+"\r\n""#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -235,14 +235,14 @@ a;",
|
||||
#[test]
|
||||
fn no_octal_escape() {
|
||||
test_from_to(
|
||||
r#"'\x00a';
|
||||
r"'\x00a';
|
||||
'\x000';
|
||||
'\x001';
|
||||
'\x009'"#,
|
||||
r#"'\x00a';
|
||||
'\x009'",
|
||||
r"'\x00a';
|
||||
'\x000';
|
||||
'\x001';
|
||||
'\x009';"#,
|
||||
'\x009';",
|
||||
);
|
||||
}
|
||||
|
||||
@ -355,11 +355,11 @@ fn named_and_namespace_export_from_min() {
|
||||
#[test]
|
||||
fn issue_450() {
|
||||
test_from_to(
|
||||
r#"console.log(`
|
||||
r"console.log(`
|
||||
\`\`\`html
|
||||
<h1>It works!</h1>
|
||||
\`\`\`
|
||||
`);"#,
|
||||
`);",
|
||||
"console.log(`\n\\`\\`\\`html\n<h1>It works!</h1>\n\\`\\`\\`\n`);",
|
||||
);
|
||||
}
|
||||
@ -438,24 +438,24 @@ fn tpl_escape_2() {
|
||||
#[test]
|
||||
fn tpl_escape_3() {
|
||||
test_from_to(
|
||||
r#"`${resolvedDevice.toLowerCase()}\\`"#,
|
||||
r#"`${resolvedDevice.toLowerCase()}\\`;"#,
|
||||
r"`${resolvedDevice.toLowerCase()}\\`",
|
||||
r"`${resolvedDevice.toLowerCase()}\\`;",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tpl_escape_4() {
|
||||
test_from_to(
|
||||
r#"`\\\\${firstPart}\\${path.slice(last)}`"#,
|
||||
r#"`\\\\${firstPart}\\${path.slice(last)}`;"#,
|
||||
r"`\\\\${firstPart}\\${path.slice(last)}`",
|
||||
r"`\\\\${firstPart}\\${path.slice(last)}`;",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tpl_escape_5() {
|
||||
test_from_to(
|
||||
r#"const data = text.encode(`${arg}\0`);"#,
|
||||
r#"const data = text.encode(`${arg}\0`);"#,
|
||||
r"const data = text.encode(`${arg}\0`);",
|
||||
r"const data = text.encode(`${arg}\0`);",
|
||||
);
|
||||
}
|
||||
|
||||
@ -485,12 +485,12 @@ fn tpl_escape_6() {
|
||||
|
||||
#[test]
|
||||
fn issue_915_1() {
|
||||
test_identical(r#"relResolveCacheIdentifier = `${parent.path}\x00${request}`;"#);
|
||||
test_identical(r"relResolveCacheIdentifier = `${parent.path}\x00${request}`;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_915_2() {
|
||||
test_identical(r#"relResolveCacheIdentifier = `${parent.path}\x00${request}`;"#);
|
||||
test_identical(r"relResolveCacheIdentifier = `${parent.path}\x00${request}`;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -500,7 +500,7 @@ fn issue_915_3() {
|
||||
|
||||
#[test]
|
||||
fn issue_915_4() {
|
||||
test_identical(r#"`\\r\\n--${this.boundary}`;"#);
|
||||
test_identical(r"`\\r\\n--${this.boundary}`;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -753,8 +753,8 @@ fn issue_3617_1() {
|
||||
let from = r"// a string of all valid unicode whitespaces
|
||||
module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
||||
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF' + '\u{a0}';";
|
||||
let expected = r#"// a string of all valid unicode whitespaces
|
||||
module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF' + '\u{a0}';"#;
|
||||
let expected = r"// a string of all valid unicode whitespaces
|
||||
module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF' + '\u{a0}';";
|
||||
|
||||
let out = parse_then_emit(
|
||||
from,
|
||||
@ -882,7 +882,7 @@ export default {
|
||||
\u3131: '\u11B0'
|
||||
};
|
||||
",
|
||||
r##"export default{\u3131:"\u11B0"}"##,
|
||||
r#"export default{\u3131:"\u11B0"}"#,
|
||||
Config {
|
||||
ascii_only: true,
|
||||
..Default::default()
|
||||
|
@ -484,7 +484,7 @@ where
|
||||
punct!("[");
|
||||
emit!(n.type_param.name);
|
||||
|
||||
if let Some(..) = &n.type_param.constraint {
|
||||
if n.type_param.constraint.is_some() {
|
||||
space!();
|
||||
keyword!("in");
|
||||
space!();
|
||||
|
@ -800,7 +800,7 @@ impl Optimizer<'_> {
|
||||
|
||||
// TODO: Check if parameter is used and inline if call is not related to parameters.
|
||||
Expr::Call(e) => {
|
||||
if let Some(..) = e.callee.as_expr().and_then(|e| e.as_ident()) {
|
||||
if e.callee.as_expr().and_then(|e| e.as_ident()).is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2540,7 +2540,7 @@ impl VisitMut for Optimizer<'_> {
|
||||
.take_stmts()
|
||||
.into_iter()
|
||||
.chain(once(s.take()))
|
||||
.chain(self.append_stmts.take_stmts().into_iter())
|
||||
.chain(self.append_stmts.take_stmts())
|
||||
.filter(|s| match s {
|
||||
Stmt::Empty(..) => false,
|
||||
Stmt::Decl(Decl::Var(v)) => !v.decls.is_empty(),
|
||||
|
@ -358,11 +358,8 @@ impl Pure<'_> {
|
||||
}
|
||||
};
|
||||
// 8. Let s be the empty String.
|
||||
// 9. If x < 0, then
|
||||
// a. Set s to "-".
|
||||
// b. Set x to -x.
|
||||
// 10. If x ≥ 10**21, then
|
||||
// a. Let m be ! ToString(𝔽(x)).
|
||||
// 9. If x < 0, then a. Set s to "-". b. Set x to -x.
|
||||
// 10. If x ≥ 10**21, then a. Let m be ! ToString(𝔽(x)).
|
||||
let value = if x >= 1e21 || x <= -1e21 {
|
||||
format!("{:e}", x).replace('e', "e+")
|
||||
} else {
|
||||
@ -781,18 +778,15 @@ fn f64_to_precision(value: f64, precision: usize) -> String {
|
||||
let mut m: String;
|
||||
let mut e: i32;
|
||||
|
||||
// 8. If x < 0, then
|
||||
// a. Set s to the code unit 0x002D (HYPHEN-MINUS).
|
||||
// b. Set x to -x.
|
||||
// 8. If x < 0, then a. Set s to the code unit 0x002D (HYPHEN-MINUS). b. Set x
|
||||
// to -x.
|
||||
if x < 0. {
|
||||
s.push('-');
|
||||
x = -x;
|
||||
}
|
||||
|
||||
// 9. If x = 0, then
|
||||
// a. Let m be the String value consisting of p occurrences of the code unit
|
||||
// 0x0030 (DIGIT ZERO).
|
||||
// b. Let e be 0.
|
||||
// 9. If x = 0, then a. Let m be the String value consisting of p occurrences of
|
||||
// the code unit 0x0030 (DIGIT ZERO). b. Let e be 0.
|
||||
if x == 0.0 {
|
||||
m = "0".repeat(precision);
|
||||
e = 0;
|
||||
|
@ -347,7 +347,7 @@ impl Pure<'_> {
|
||||
|
||||
{
|
||||
let l_last = l.quasis.pop().unwrap();
|
||||
let mut r_first = rt.quasis.first_mut().unwrap();
|
||||
let r_first = rt.quasis.first_mut().unwrap();
|
||||
let new: Atom = format!("{}{}", l_last.raw, r_first.raw).into();
|
||||
|
||||
r_first.raw = new;
|
||||
|
@ -536,6 +536,7 @@ impl VarDataLike for VarUsageInfo {
|
||||
}
|
||||
|
||||
impl ProgramData {
|
||||
#[allow(clippy::single_range_in_vec_init)]
|
||||
pub(crate) fn expand_infected(
|
||||
&self,
|
||||
module_info: &ModuleInfo,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -150,7 +150,7 @@ impl<'a> Lexer<'a> {
|
||||
raw_str.push_str(raw.0.as_ref().unwrap());
|
||||
|
||||
val = {
|
||||
if let Some(..) = dec_val {
|
||||
if dec_val.is_some() {
|
||||
raw_val.push_str(raw.0.as_ref().unwrap());
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ fn test262_lexer_error_0001() {
|
||||
#[test]
|
||||
fn test262_lexer_error_0002() {
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"'use\x20strict';"#),
|
||||
lex(Syntax::default(), r"'use\x20strict';"),
|
||||
vec![
|
||||
Token::Str {
|
||||
value: "use strict".into(),
|
||||
@ -207,10 +207,7 @@ fn test262_lexer_error_0002() {
|
||||
|
||||
#[test]
|
||||
fn test262_lexer_error_0003() {
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"\u0061"#),
|
||||
vec!["a".span(0..6).lb()]
|
||||
);
|
||||
assert_eq!(lex(Syntax::default(), r"\u0061"), vec!["a".span(0..6).lb()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -224,7 +221,7 @@ fn test262_lexer_error_0004() {
|
||||
#[test]
|
||||
fn ident_escape_unicode() {
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"a\u0061"#),
|
||||
lex(Syntax::default(), r"a\u0061"),
|
||||
vec!["aa".span(0..7).lb()]
|
||||
);
|
||||
}
|
||||
@ -234,7 +231,7 @@ fn ident_escape_unicode_2() {
|
||||
assert_eq!(lex(Syntax::default(), "℘℘"), vec!["℘℘".span(0..6).lb()]);
|
||||
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"℘\u2118"#),
|
||||
lex(Syntax::default(), r"℘\u2118"),
|
||||
vec!["℘℘".span(0..9).lb()]
|
||||
);
|
||||
}
|
||||
@ -341,7 +338,7 @@ fn tpl_invalid_unicode_escape() {
|
||||
#[test]
|
||||
fn str_escape() {
|
||||
assert_eq!(
|
||||
lex_tokens(Syntax::default(), r#"'\n'"#),
|
||||
lex_tokens(Syntax::default(), r"'\n'"),
|
||||
vec![Token::Str {
|
||||
value: "\n".into(),
|
||||
raw: "'\\n'".into(),
|
||||
@ -352,7 +349,7 @@ fn str_escape() {
|
||||
#[test]
|
||||
fn str_escape_2() {
|
||||
assert_eq!(
|
||||
lex_tokens(Syntax::default(), r#"'\\n'"#),
|
||||
lex_tokens(Syntax::default(), r"'\\n'"),
|
||||
vec![Token::Str {
|
||||
value: "\\n".into(),
|
||||
raw: "'\\\\n'".into(),
|
||||
@ -363,7 +360,7 @@ fn str_escape_2() {
|
||||
#[test]
|
||||
fn str_escape_3() {
|
||||
assert_eq!(
|
||||
lex_tokens(Syntax::default(), r#"'\x00'"#),
|
||||
lex_tokens(Syntax::default(), r"'\x00'"),
|
||||
vec![Token::Str {
|
||||
value: "\x00".into(),
|
||||
raw: "'\\x00'".into(),
|
||||
@ -374,7 +371,7 @@ fn str_escape_3() {
|
||||
#[test]
|
||||
fn str_escape_hex() {
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"'\x61'"#),
|
||||
lex(Syntax::default(), r"'\x61'"),
|
||||
vec![Token::Str {
|
||||
value: "a".into(),
|
||||
raw: "'\\x61'".into(),
|
||||
@ -387,7 +384,7 @@ fn str_escape_hex() {
|
||||
#[test]
|
||||
fn str_escape_octal() {
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"'Hello\012World'"#),
|
||||
lex(Syntax::default(), r"'Hello\012World'"),
|
||||
vec![Token::Str {
|
||||
value: "Hello\nWorld".into(),
|
||||
raw: "'Hello\\012World'".into(),
|
||||
@ -400,7 +397,7 @@ fn str_escape_octal() {
|
||||
#[test]
|
||||
fn str_escape_unicode_long() {
|
||||
assert_eq!(
|
||||
lex(Syntax::default(), r#"'\u{00000000034}'"#),
|
||||
lex(Syntax::default(), r"'\u{00000000034}'"),
|
||||
vec![Token::Str {
|
||||
value: "4".into(),
|
||||
raw: "'\\u{00000000034}'".into(),
|
||||
@ -930,7 +927,7 @@ fn tpl() {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
lex_tokens(Syntax::default(), r#"`te\nst${a}test`"#),
|
||||
lex_tokens(Syntax::default(), r"`te\nst${a}test`"),
|
||||
vec![
|
||||
tok!('`'),
|
||||
Template {
|
||||
@ -1612,7 +1609,7 @@ fn issue_481() {
|
||||
#[test]
|
||||
fn issue_915_1() {
|
||||
assert_eq!(
|
||||
lex_tokens(crate::Syntax::Es(Default::default()), r##"encode("\r\n")"##),
|
||||
lex_tokens(crate::Syntax::Es(Default::default()), r#"encode("\r\n")"#),
|
||||
vec![
|
||||
Word(Word::Ident("encode".into())),
|
||||
LParen,
|
||||
|
@ -1092,7 +1092,7 @@ impl<I: Tokens> Parser<I> {
|
||||
p.emit_err(p.input.cur_span(), SyntaxError::TS1005);
|
||||
}
|
||||
|
||||
if let Some(..) = accessor_token {
|
||||
if accessor_token.is_some() {
|
||||
return Ok(ClassMember::AutoAccessor(AutoAccessor {
|
||||
span: span!(p, start),
|
||||
key,
|
||||
|
@ -229,7 +229,7 @@ impl<I: Tokens> Parser<I> {
|
||||
};
|
||||
|
||||
let mut attrs = vec![];
|
||||
while let Ok(..) = cur!(self, false) {
|
||||
while cur!(self, false).is_ok() {
|
||||
trace_cur!(self, parse_jsx_opening__attrs_loop);
|
||||
|
||||
if is!(self, '/') || is!(self, JSXTagEnd) {
|
||||
|
@ -96,6 +96,11 @@ fn add_test<F: FnOnce() -> Result<(), String> + Send + 'static>(
|
||||
compile_fail: false,
|
||||
no_run: false,
|
||||
ignore_message: Default::default(),
|
||||
source_file: Default::default(),
|
||||
start_line: 0,
|
||||
start_col: 0,
|
||||
end_line: 0,
|
||||
end_col: 0,
|
||||
},
|
||||
testfn: DynTestFn(Box::new(f)),
|
||||
});
|
||||
|
@ -212,7 +212,7 @@ fn exec(c: PresetConfig, dir: PathBuf) -> Result<(), Error> {
|
||||
};
|
||||
|
||||
let actual_src = print(&actual);
|
||||
if let Ok(..) = env::var("UPDATE") {
|
||||
if env::var("UPDATE").is_ok() {
|
||||
NormalizedOutput::from(actual_src.clone())
|
||||
.compare_to_file(dir.join("output.mjs"))
|
||||
.unwrap();
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::redundant_closure_call)]
|
||||
|
||||
extern crate swc_node_base;
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, Bencher, Criterion};
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::redundant_closure_call)]
|
||||
|
||||
extern crate swc_node_base;
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, Bencher, Criterion};
|
||||
|
@ -147,7 +147,7 @@ impl<'a> VisitMut for Operator<'a> {
|
||||
let exported = s.orig.clone();
|
||||
|
||||
if let ModuleExportName::Ident(orig) = &mut s.orig {
|
||||
if let Ok(..) = self.rename_ident(orig) {
|
||||
if self.rename_ident(orig).is_ok() {
|
||||
match &exported {
|
||||
ModuleExportName::Ident(exported) => {
|
||||
if orig.sym == exported.sym {
|
||||
@ -177,7 +177,7 @@ impl<'a> VisitMut for Operator<'a> {
|
||||
let imported = s.local.clone();
|
||||
let local = self.rename_ident(&mut s.local);
|
||||
|
||||
if let Ok(..) = local {
|
||||
if local.is_ok() {
|
||||
if s.local.sym == imported.sym {
|
||||
return;
|
||||
}
|
||||
@ -488,7 +488,7 @@ impl<'a> VisitMut for Operator<'a> {
|
||||
|
||||
if let ObjectPatProp::Assign(p) = n {
|
||||
let mut renamed = p.key.clone();
|
||||
if let Ok(..) = self.rename_ident(&mut renamed) {
|
||||
if self.rename_ident(&mut renamed).is_ok() {
|
||||
if renamed.sym == p.key.sym {
|
||||
return;
|
||||
}
|
||||
@ -513,7 +513,7 @@ impl<'a> VisitMut for Operator<'a> {
|
||||
match prop {
|
||||
Prop::Shorthand(i) => {
|
||||
let mut renamed = i.clone();
|
||||
if let Ok(..) = self.rename_ident(&mut renamed) {
|
||||
if self.rename_ident(&mut renamed).is_ok() {
|
||||
if renamed.sym == i.sym {
|
||||
return;
|
||||
}
|
||||
@ -589,7 +589,7 @@ impl VisitMut for VarFolder<'_, '_> {
|
||||
|
||||
fn visit_mut_ident(&mut self, i: &mut Ident) {
|
||||
let orig = i.clone();
|
||||
if let Ok(..) = self.orig.rename_ident(i) {
|
||||
if self.orig.rename_ident(i).is_ok() {
|
||||
self.renamed
|
||||
.push(ExportSpecifier::Named(ExportNamedSpecifier {
|
||||
span: i.span,
|
||||
|
@ -107,6 +107,11 @@ fn add_test<F: FnOnce() -> Result<(), String> + Send + 'static>(
|
||||
compile_fail: false,
|
||||
no_run: false,
|
||||
ignore_message: Default::default(),
|
||||
source_file: Default::default(),
|
||||
start_line: 0,
|
||||
start_col: 0,
|
||||
end_line: 0,
|
||||
end_col: 0,
|
||||
},
|
||||
testfn: DynTestFn(Box::new(f)),
|
||||
});
|
||||
|
@ -140,7 +140,7 @@ impl Scope {
|
||||
/// console.log(a)
|
||||
/// ```
|
||||
fn can_access(&self, id: &Id, parent: ParentScope, deny_let_const: bool) -> bool {
|
||||
if let Some(..) = parent.get_var(id) {
|
||||
if parent.get_var(id).is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2285,7 +2285,7 @@ test_exec!(
|
||||
syntax(),
|
||||
|_| tr(),
|
||||
issue_7418,
|
||||
r###"
|
||||
r#"
|
||||
const truc = { as: "OK"}
|
||||
|
||||
function x(as) {
|
||||
@ -2297,5 +2297,5 @@ test_exec!(
|
||||
}
|
||||
|
||||
x()();
|
||||
"###
|
||||
"#
|
||||
);
|
||||
|
@ -152,7 +152,7 @@ test!(
|
||||
syntax(),
|
||||
|_| tr(Default::default()),
|
||||
template_revision,
|
||||
r#"tag`\unicode and \u{55}`;
|
||||
r"tag`\unicode and \u{55}`;
|
||||
tag`\01`;
|
||||
tag`\xg${0}right`;
|
||||
tag`left${0}\xg`;
|
||||
@ -162,7 +162,7 @@ tag`left${0}\u{-0}${1}right`;
|
||||
function a() {
|
||||
var undefined = 4;
|
||||
tag`\01`;
|
||||
}"#,
|
||||
}",
|
||||
r#"function _templateObject() {
|
||||
const data = _tagged_template_literal([
|
||||
void 0
|
||||
@ -428,7 +428,7 @@ test!(
|
||||
syntax(),
|
||||
|_| tr(Default::default()),
|
||||
default_template_revision,
|
||||
r#"
|
||||
r"
|
||||
tag`\unicode and \u{55}`;
|
||||
|
||||
tag`\01`;
|
||||
@ -443,7 +443,7 @@ function a() {
|
||||
tag`\01`;
|
||||
}
|
||||
|
||||
"#,
|
||||
",
|
||||
r#"
|
||||
function _templateObject8() {
|
||||
const data = _tagged_template_literal([void 0], ["\\01"]);
|
||||
@ -708,12 +708,12 @@ test!(
|
||||
syntax(),
|
||||
|_| tr(Default::default()),
|
||||
default_tag,
|
||||
r#"
|
||||
r"
|
||||
var foo = bar`wow\na${ 42 }b ${_.foobar()}`;
|
||||
var bar = bar`wow\nab${ 42 } ${_.foobar()}`;
|
||||
var bar = bar`wow\naB${ 42 } ${_.baz()}`;
|
||||
|
||||
"#,
|
||||
",
|
||||
r#"
|
||||
function _templateObject() {
|
||||
const data = _tagged_template_literal(["wow\na", "b ", ""], ["wow\\na", "b ", ""]);
|
||||
@ -1245,11 +1245,11 @@ test!(
|
||||
mutable_template: true
|
||||
}),
|
||||
loose_tag,
|
||||
r#"
|
||||
r"
|
||||
var foo = bar`wow\na${ 42 }b ${_.foobar()}`;
|
||||
var bar = bar`wow\nab${ 42 } ${_.foobar()}`;
|
||||
var bar = bar`wow\naB${ 42 } ${_.baz()}`;
|
||||
"#,
|
||||
",
|
||||
r#"
|
||||
function _templateObject() {
|
||||
const data = _tagged_template_literal_loose([
|
||||
@ -1308,7 +1308,7 @@ test!(
|
||||
syntax(),
|
||||
|_| tr(Default::default()),
|
||||
loose_template_revision,
|
||||
r#"tag`\unicode and \u{55}`;
|
||||
r"tag`\unicode and \u{55}`;
|
||||
tag`\01`;
|
||||
tag`\xg${0}right`;
|
||||
tag`left${0}\xg`;
|
||||
@ -1318,7 +1318,7 @@ tag`left${0}\u{-0}${1}right`;
|
||||
function a() {
|
||||
var undefined = 4;
|
||||
tag`\01`;
|
||||
}"#,
|
||||
}",
|
||||
r#"
|
||||
function _templateObject8() {
|
||||
const data = _tagged_template_literal_loose([void 0], ["\\01"]);
|
||||
|
@ -453,9 +453,8 @@ where
|
||||
|
||||
fn get_amd_module_id_from_comments(&self, span: Span) -> Option<String> {
|
||||
// https://github.com/microsoft/TypeScript/blob/1b9c8a15adc3c9a30e017a7048f98ef5acc0cada/src/compiler/parser.ts#L9648-L9658
|
||||
let amd_module_re = Regex::new(
|
||||
r##"(?i)^/\s*<amd-module.*?name\s*=\s*(?:(?:'([^']*)')|(?:"([^"]*)")).*?/>"##,
|
||||
)
|
||||
let amd_module_re =
|
||||
Regex::new(r#"(?i)^/\s*<amd-module.*?name\s*=\s*(?:(?:'([^']*)')|(?:"([^"]*)")).*?/>"#)
|
||||
.unwrap();
|
||||
|
||||
self.comments.as_ref().and_then(|comments| {
|
||||
|
@ -71,7 +71,7 @@ where
|
||||
}
|
||||
|
||||
fn visit_mut_export_all(&mut self, n: &mut ExportAll) {
|
||||
let mut src = &mut n.src;
|
||||
let src = &mut n.src;
|
||||
|
||||
let new = self
|
||||
.resolver
|
||||
|
@ -163,7 +163,7 @@ impl VisitMut for ConstModules {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(..) = self.scope.namespace.get(&id.to_id()) {
|
||||
if self.scope.namespace.get(&id.to_id()).is_some() {
|
||||
panic!(
|
||||
"The const_module namespace `{}` cannot be used without member accessor",
|
||||
sym
|
||||
@ -219,7 +219,7 @@ impl VisitMut for ConstModules {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(..) = self.scope.namespace.get(&id.to_id()) {
|
||||
if self.scope.namespace.get(&id.to_id()).is_some() {
|
||||
panic!(
|
||||
"The const_module namespace `{}` cannot be used without member accessor",
|
||||
id.sym
|
||||
|
@ -315,7 +315,7 @@ mod tests {
|
||||
::swc_ecma_parser::Syntax::default(),
|
||||
|_| json_parse(0),
|
||||
tpl,
|
||||
r#"const a = [`\x22\x21\x224`];"#,
|
||||
r"const a = [`\x22\x21\x224`];",
|
||||
r#"const a = JSON.parse('["\\"!\\"4"]');"#
|
||||
);
|
||||
test!(
|
||||
|
@ -521,7 +521,7 @@ impl VisitMut for Inlining<'_> {
|
||||
}
|
||||
PatFoldingMode::VarDecl => {}
|
||||
PatFoldingMode::Assign => {
|
||||
if let Some(..) = self.scope.find_binding_from_current(&i.to_id()) {
|
||||
if self.scope.find_binding_from_current(&i.to_id()).is_some() {
|
||||
} else {
|
||||
self.scope.add_write(&i.to_id(), false);
|
||||
}
|
||||
|
@ -291,10 +291,10 @@ impl<'a> Scope<'a> {
|
||||
|
||||
/// True if the returned scope is self
|
||||
fn scope_for(&self, id: &Id) -> (&Scope, bool) {
|
||||
if let Some(..) = self.constants.get(id) {
|
||||
if self.constants.get(id).is_some() {
|
||||
return (self, true);
|
||||
}
|
||||
if let Some(..) = self.find_binding_from_current(id) {
|
||||
if self.find_binding_from_current(id).is_some() {
|
||||
return (self, true);
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ impl<'a> Scope<'a> {
|
||||
}
|
||||
|
||||
fn has_constant(&self, id: &Id) -> bool {
|
||||
if let Some(..) = self.constants.get(id) {
|
||||
if self.constants.get(id).is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ use super::EnumKind;
|
||||
pub(super) struct ParamMetadata;
|
||||
|
||||
impl VisitMut for ParamMetadata {
|
||||
fn visit_mut_class(&mut self, mut cls: &mut Class) {
|
||||
fn visit_mut_class(&mut self, cls: &mut Class) {
|
||||
cls.visit_mut_children_with(self);
|
||||
|
||||
let mut decorators = cls.decorators.take();
|
||||
|
@ -783,7 +783,7 @@ test!(
|
||||
}),
|
||||
|t| tr(t, Default::default(), Mark::fresh(Mark::root())),
|
||||
react_should_escape_xhtml_jsxtext_1,
|
||||
r#"
|
||||
r"
|
||||
<div>wow</div>;
|
||||
<div>wôw</div>;
|
||||
|
||||
@ -794,7 +794,7 @@ test!(
|
||||
<div>this should parse as unicode: {'\u00a0 '}</div>;
|
||||
|
||||
<div>w < w</div>;
|
||||
"#,
|
||||
",
|
||||
r#"
|
||||
React.createElement("div", null, "wow");
|
||||
React.createElement("div", null, "w\xf4w");
|
||||
@ -814,9 +814,9 @@ test!(
|
||||
}),
|
||||
|t| tr(t, Default::default(), Mark::fresh(Mark::root())),
|
||||
react_should_escape_xhtml_jsxtext_2,
|
||||
r#"
|
||||
r"
|
||||
<div>this should not parse as unicode: \u00a0</div>;
|
||||
"#,
|
||||
",
|
||||
r#"
|
||||
React.createElement("div", null, "this should not parse as unicode: \\u00a0");
|
||||
"#,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![deny(clippy::all)]
|
||||
#![allow(clippy::arc_with_non_send_sync)]
|
||||
|
||||
use swc_common::{chain, comments::Comments, sync::Lrc, Mark, SourceMap};
|
||||
use swc_ecma_visit::{Fold, VisitMut};
|
||||
|
@ -1258,7 +1258,7 @@ where
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
if let Some(..) = &self.marks {
|
||||
if self.marks.is_some() {
|
||||
if let VarDeclarator {
|
||||
name: Pat::Ident(id),
|
||||
init: Some(..),
|
||||
|
@ -540,10 +540,10 @@ pub trait ExprExt {
|
||||
fn is_immutable_value(&self) -> bool {
|
||||
// TODO(johnlenz): rename this function. It is currently being used
|
||||
// in two disjoint cases:
|
||||
// 1) We only care about the result of the expression
|
||||
// (in which case NOT here should return true)
|
||||
// 2) We care that expression is a side-effect free and can't
|
||||
// be side-effected by other expressions.
|
||||
// 1) We only care about the result of the expression (in which case NOT here
|
||||
// should return true)
|
||||
// 2) We care that expression is a side-effect free and can't be side-effected
|
||||
// by other expressions.
|
||||
// This should only be used to say the value is immutable and
|
||||
// hasSideEffects and canBeSideEffected should be used for the other case.
|
||||
match *self.as_expr() {
|
||||
|
@ -74,6 +74,11 @@ fn fixtures() -> Result<(), Error> {
|
||||
compile_fail: false,
|
||||
no_run: false,
|
||||
ignore_message: Default::default(),
|
||||
source_file: Default::default(),
|
||||
start_line: 0,
|
||||
start_col: 0,
|
||||
end_line: 0,
|
||||
end_col: 0,
|
||||
},
|
||||
testfn: DynTestFn(Box::alloc().init(move || {
|
||||
GLOBALS.set(&Default::default(), || {
|
||||
|
@ -729,7 +729,7 @@ where
|
||||
},
|
||||
// A tfoot element's end tag can be omitted if there is no more content in the
|
||||
// parent element.
|
||||
js_word!("tfoot") => matches!(next, None),
|
||||
js_word!("tfoot") => next.is_none(),
|
||||
// A tr element's end tag can be omitted if the tr element is immediately
|
||||
// followed by another tr element, or if there is no more content in the parent
|
||||
// element.
|
||||
|
@ -70,7 +70,7 @@ impl Drop for Node {
|
||||
while let Some(node) = nodes.pop() {
|
||||
let children = mem::take(&mut *node.children.borrow_mut());
|
||||
|
||||
nodes.extend(children.into_iter());
|
||||
nodes.extend(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -660,8 +660,8 @@ fn html5lib_test_tree_construction(input: PathBuf) {
|
||||
file_stem.push_str(&counter.to_string());
|
||||
|
||||
// TODO workaround, fix - https://github.com/html5lib/html5lib-tests/pull/151
|
||||
let need_skip_fragment = relative_path_to_test.contains("template_dat")
|
||||
&& matches!(counter, 109 | 110 | 111);
|
||||
let need_skip_fragment =
|
||||
relative_path_to_test.contains("template_dat") && matches!(counter, 109..=111);
|
||||
|
||||
if !need_skip_fragment && !document_fragment.is_empty() {
|
||||
file_stem += ".fragment_";
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use swc_common::sync::{Lazy, OnceCell};
|
||||
use swc_common::sync::Lazy;
|
||||
use wasmer::Store;
|
||||
use wasmer_wasix::Runtime;
|
||||
|
||||
|
@ -2858,7 +2858,7 @@ fn create_method_body(mode: Mode, ty: &Type) -> Block {
|
||||
let ident = method_name(mode, arg);
|
||||
|
||||
if let Mode::Fold(..) = mode {
|
||||
if let Some(..) = as_box(arg) {
|
||||
if as_box(arg).is_some() {
|
||||
let inner = inject_ast_path_arg_if_required(
|
||||
mode,
|
||||
q!(Vars { ident }, { _visitor.ident(n) }).parse(),
|
||||
@ -2932,7 +2932,7 @@ fn create_method_body(mode: Mode, ty: &Type) -> Block {
|
||||
|
||||
match mode {
|
||||
Mode::Fold(v) => {
|
||||
if let Some(..) = as_box(arg) {
|
||||
if as_box(arg).is_some() {
|
||||
return match v {
|
||||
VisitorVariant::Normal => q!(
|
||||
Vars { ident },
|
||||
|
@ -74,7 +74,7 @@ impl Drop for Node {
|
||||
while let Some(node) = nodes.pop() {
|
||||
let children = mem::take(&mut *node.children.borrow_mut());
|
||||
|
||||
nodes.extend(children.into_iter());
|
||||
nodes.extend(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
nightly-2023-03-20
|
||||
nightly-2023-07-03
|
Loading…
Reference in New Issue
Block a user