repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs | crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs | use std::{borrow::Cow, iter, iter::once};
use swc_atoms::{
atom,
wtf8::{CodePoint, Wtf8, Wtf8Buf},
Atom,
};
use swc_common::{
pass::{CompilerPass, Repeated},
util::take::Take,
Mark, Span, Spanned, SyntaxContext, DUMMY_SP,
};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::{
ext::ExprRefE... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/tests/const_modules.rs | crates/swc_ecma_transforms_optimization/tests/const_modules.rs | use std::{collections::HashMap, fs::read_to_string, path::PathBuf};
use swc_ecma_ast::Pass;
use swc_ecma_transforms_optimization::const_modules;
use swc_ecma_transforms_testing::{test, test_fixture, Tester};
fn tr(t: &mut Tester<'_>, sources: &[(&str, &[(&str, &str)])]) -> impl Pass {
let mut m = HashMap::default... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/tests/simplify.rs | crates/swc_ecma_transforms_optimization/tests/simplify.rs | //! Copied from PeepholeIntegrationTest from the google closure compiler.
#![deny(warnings)]
use swc_common::{pass::Repeat, Mark};
use swc_ecma_parser::{Syntax, TsSyntax};
use swc_ecma_transforms_base::{helpers::inject_helpers, resolver};
use swc_ecma_transforms_compat::{es2015, es2016, es2017, es2018, es2022::class_... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/tests/remove_imports_with_side_effects.rs | crates/swc_ecma_transforms_optimization/tests/remove_imports_with_side_effects.rs | use swc_common::{pass::Repeat, Mark};
use swc_ecma_ast::Pass;
use swc_ecma_parser::{EsSyntax, Syntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_optimization::simplify::dce::{dce, Config};
use swc_ecma_transforms_testing::test;
fn tr() -> impl Pass {
Repeat::new(dce(
Config {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/tests/fixture.rs | crates/swc_ecma_transforms_optimization/tests/fixture.rs | use std::path::PathBuf;
use swc_common::{pass::Repeat, Mark};
use swc_ecma_ast::Pass;
use swc_ecma_parser::{EsSyntax, Syntax};
use swc_ecma_transforms_base::fixer::paren_remover;
use swc_ecma_transforms_optimization::simplify::{dce::dce, expr_simplifier};
use swc_ecma_transforms_testing::{test_fixture, Tester};
use sw... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/tests/simplify_dce.rs | crates/swc_ecma_transforms_optimization/tests/simplify_dce.rs | use swc_common::{pass::Repeat, Mark};
use swc_ecma_ast::Pass;
use swc_ecma_parser::{EsSyntax, Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_compat::es2022::class_properties;
use swc_ecma_transforms_optimization::simplify::dce::{dce, Config};
use swc_ecma_transforms_proposal::decorat... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_optimization/tests/simplify_inlining.rs | crates/swc_ecma_transforms_optimization/tests/simplify_inlining.rs | //! Copied from https://github.com/google/closure-compiler/blob/6ca3b62990064488074a1a8931b9e8dc39b148b3/test/com/google/javascript/jscomp/InlineVariablesTest.java
use swc_common::Mark;
use swc_ecma_ast::Pass;
use swc_ecma_parser::{Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_comp... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecmascript/src/lib.rs | crates/swc_ecmascript/src/lib.rs | #![deny(clippy::all)]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use swc_ecma_ast as ast;
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
pub use swc_ecma_codegen as codegen;
#[cfg(feature = "minifier")]
#[cfg_attr(docsrs, doc(cfg(feature = "minifier")))]
pub use swc_ecma_minifier as min... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_visit/src/lib.rs | crates/swc_ecma_visit/src/lib.rs | // This is not a public api.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]
#[doc(hidden)]
pub extern crate swc_ecma_ast;
use std::{borrow::Cow, fmt::Debug};
use swc_common::{pass::CompilerPass, util::take::Take, Span, DUMMY_SP};
use swc_ecma_ast::*;
use swc_visit::{Repeat, R... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_visit/src/generated.rs | crates/swc_ecma_visit/src/generated.rs | #![doc = r" This file is generated by `tools/generate-code`. DO NOT MODIFY."]
#![allow(unused_variables)]
#![allow(clippy::all)]
pub use ::swc_visit::All;
use swc_ecma_ast::*;
#[doc = r" A visitor trait for traversing the AST."]
pub trait Visit {
#[doc = "Visit a node of type `Accessibility`.\n\nBy default, this me... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_visit/tests/main.rs | crates/swc_ecma_visit/tests/main.rs | use swc_atoms::atom;
use swc_common::DUMMY_SP;
use swc_ecma_ast::*;
use swc_ecma_visit::NodeRef;
#[test]
fn traverse_lookup() {
let node = Expr::Call(CallExpr {
span: DUMMY_SP,
callee: Callee::Expr(
AwaitExpr {
span: DUMMY_SP,
arg: Ident::new_no_ctxt(atom... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_regexp_ast/src/lib.rs | crates/swc_ecma_regexp_ast/src/lib.rs | use bitflags::bitflags;
use is_macro::Is;
use swc_atoms::Atom;
use swc_common::{ast_node, EqIgnoreSpan, Span};
mod display;
/// The root of the `PatternParser` result.
#[ast_node]
#[derive(Eq, Hash, EqIgnoreSpan)]
pub struct Pattern {
pub span: Span,
pub body: Disjunction,
}
/// Pile of [`Alternative`]s sepa... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_regexp_ast/src/display.rs | crates/swc_ecma_regexp_ast/src/display.rs | use std::{
borrow::Cow,
fmt::{self, Display},
iter::Peekable,
};
use swc_ecma_regexp_common::{combine_surrogate_pair, is_lead_surrogate, is_trail_surrogate};
use super::*;
impl Display for Pattern {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.body.fmt(f)
}
}
impl Display ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/dynamic.rs | crates/hstr/src/dynamic.rs | use std::{
borrow::Cow,
cell::RefCell,
ffi::c_void,
hash::{BuildHasherDefault, Hash, Hasher},
mem::ManuallyDrop,
num::NonZeroU8,
ops::Deref,
ptr::NonNull,
};
use rustc_hash::FxHasher;
use triomphe::ThinArc;
use crate::{
tagged_value::{TaggedValue, MAX_INLINE_LEN},
wtf8::Wtf8,
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/tagged_value.rs | crates/hstr/src/tagged_value.rs | #![allow(clippy::missing_transmute_annotations)]
use std::{num::NonZeroU8, os::raw::c_void, ptr::NonNull, slice};
#[cfg(feature = "atom_size_128")]
type RawTaggedValue = u128;
#[cfg(any(
target_pointer_width = "32",
target_pointer_width = "16",
feature = "atom_size_64"
))]
type RawTaggedValue = u64;
#[cfg... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/lib.rs | crates/hstr/src/lib.rs | #![cfg_attr(feature = "atom_size_128", feature(integer_atomics))]
//! See [Atom] for more information.
use core::str;
use std::{
borrow::Borrow,
fmt::{Debug, Display},
hash::Hash,
mem::{self, forget, transmute, ManuallyDrop},
num::NonZeroU8,
ops::Deref,
str::from_utf8_unchecked,
};
use deb... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/tests.rs | crates/hstr/src/tests.rs | use crate::{wtf8::Wtf8, Atom, AtomStore, Wtf8Atom};
fn store_with_atoms(texts: Vec<&str>) -> (AtomStore, Vec<Atom>) {
let mut store = AtomStore::default();
let atoms = { texts.into_iter().map(|text| store.atom(text)).collect() };
(store, atoms)
}
fn store_with_wtf8_atoms(texts: Vec<&Wtf8>) -> (AtomStore... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/macros.rs | crates/hstr/src/macros.rs | macro_rules! get_hash {
($self:expr) => {
match $self.tag() {
DYNAMIC_TAG => {
let unsafe_data = $self.unsafe_data;
unsafe { $crate::dynamic::deref_from(unsafe_data) }
.header
.header
.hash
}
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/wtf8_atom.rs | crates/hstr/src/wtf8_atom.rs | use std::{
fmt::Debug,
hash::Hash,
mem::{forget, transmute, ManuallyDrop},
ops::Deref,
};
use debug_unreachable::debug_unreachable;
use crate::{
macros::{get_hash, impl_from_alias, partial_eq},
tagged_value::TaggedValue,
wtf8::Wtf8,
Atom, DYNAMIC_TAG, INLINE_TAG, LEN_MASK, LEN_OFFSET, ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/global_store.rs | crates/hstr/src/global_store.rs | use std::{
borrow::Cow,
mem::{forget, ManuallyDrop},
};
use crate::{
dynamic::{global_atom, global_wtf8_atom},
wtf8::{Wtf8, Wtf8Buf},
Atom, Wtf8Atom,
};
macro_rules! direct_from_impl {
($T:ty) => {
impl From<$T> for Atom {
fn from(s: $T) -> Self {
global_ato... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/wtf8/not_quite_std.rs | crates/hstr/src/wtf8/not_quite_std.rs | // Copyright (c) 2014 Simon Sapin
// Licensed under the MIT License
// Original source: https://github.com/SimonSapin/rust-wtf8
//! The code in this module is copied from Rust standard library
//! (the `std` crate and crates it is a facade for)
//! at commit 16d80de231abb2b1756f3951ffd4776d681035eb,
//! with the signa... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/src/wtf8/mod.rs | crates/hstr/src/wtf8/mod.rs | // Copyright (c) 2014 Simon Sapin
// Licensed under the MIT License
// Original source: https://github.com/SimonSapin/rust-wtf8
/*!
Implementation of [the WTF-8 encoding](https://simonsapin.github.io/wtf-8/).
This library uses Rust’s type system to maintain
[well-formedness](https://simonsapin.github.io/wtf-8/#well-... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/benches/libs.rs | crates/hstr/benches/libs.rs | #![allow(clippy::redundant_closure_call)]
extern crate swc_malloc;
#[macro_use]
extern crate criterion;
use std::{hash::Hash, mem::forget};
use compact_str::CompactString;
use criterion::{black_box, BatchSize, BenchmarkId, Criterion};
use par_iter::prelude::*;
use rand::distributions::{Alphanumeric, DistString};
use... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/examples/global_api.rs | crates/hstr/examples/global_api.rs | fn main() {}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/hstr/examples/fast_api.rs | crates/hstr/examples/fast_api.rs | fn main() {}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_react_compiler/src/lib.rs | crates/swc_ecma_react_compiler/src/lib.rs | pub mod fast_check;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_react_compiler/src/fast_check.rs | crates/swc_ecma_react_compiler/src/fast_check.rs | use swc_ecma_ast::{
Callee, ExportDefaultDecl, ExportDefaultExpr, Expr, FnDecl, FnExpr, Pat, Program, Stmt,
VarDeclarator,
};
use swc_ecma_visit::{Visit, VisitWith};
pub fn is_required(program: &Program) -> bool {
let mut finder = Finder::default();
finder.visit_program(program);
finder.found
}
#[d... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_html_utils/src/lib.rs | crates/swc_html_utils/src/lib.rs | use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
#[derive(Serialize, Deserialize, Debug)]
pub struct Entity {
pub characters: String,
}
pub static HTML_ENTITIES: Lazy<FxHashMap<String, Entity>> = Lazy::new(|| {
let entities: FxHashMap<String, Enti... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/jsdoc/src/ast.rs | crates/jsdoc/src/ast.rs | #![allow(unexpected_cfgs)]
use swc_atoms::Atom;
use swc_common::{ast_node, Span};
/// Spanned text
#[ast_node]
#[derive(Eq)]
pub struct Text {
pub span: Span,
pub value: Atom,
}
#[ast_node]
pub struct JsDoc {
pub span: Span,
pub description: Text,
pub tags: Vec<TagItem>,
}
/// tag with comment... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/jsdoc/src/lib.rs | crates/jsdoc/src/lib.rs | use nom::{
bytes::complete::{tag, take_while},
error::ErrorKind,
IResult, InputIter, Slice,
};
use swc_common::{Span, Spanned};
pub use self::input::Input;
use crate::ast::*;
pub mod ast;
mod input;
pub fn parse(i: Input) -> IResult<Input, JsDoc> {
let i = skip(i);
let mut tags = Vec::new();
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/jsdoc/src/input.rs | crates/jsdoc/src/input.rs | use std::{
ops::{Deref, Range, RangeFrom, RangeTo},
str::{CharIndices, Chars},
};
use nom::{
Compare, CompareResult, InputIter, InputLength, InputTake, Needed, Slice, UnspecializedInput,
};
use swc_common::{comments::Comment, BytePos, Span};
use crate::ast::Text;
#[derive(Debug, Clone, Copy)]
pub struct ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/jsdoc/tests/fixture.rs | crates/jsdoc/tests/fixture.rs | use std::path::PathBuf;
use dashmap::DashMap;
use swc_common::{
comments::{Comment, CommentKind, Comments},
BytePos, DUMMY_SP,
};
use swc_ecma_parser::{parse_file_as_module, EsSyntax, Syntax};
use testing::NormalizedOutput;
#[testing::fixture("tests/fixtures/**/*.js")]
fn fixture(path: PathBuf) {
testing:... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_regexp_common/src/lib.rs | crates/swc_ecma_regexp_common/src/lib.rs | mod surrogate_pair;
pub use crate::surrogate_pair::*;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_regexp_common/src/surrogate_pair.rs | crates/swc_ecma_regexp_common/src/surrogate_pair.rs | pub fn is_lead_surrogate(cp: u32) -> bool {
(0xd800..=0xdbff).contains(&cp)
}
pub fn is_trail_surrogate(cp: u32) -> bool {
(0xdc00..=0xdfff).contains(&cp)
}
pub fn combine_surrogate_pair(lead: u32, trail: u32) -> u32 {
(lead - 0xd800) * 0x400 + trail - 0xdc00 + 0x10000
}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/lib.rs | crates/swc_ecma_transforms_base/src/lib.rs | // #![cfg_attr(test, deny(warnings))]
#![allow(clippy::mutable_key_type)]
#![cfg_attr(not(test), allow(unused))]
pub use self::resolver::resolver;
#[doc(hidden)]
pub mod ext;
pub mod fixer;
#[macro_use]
pub mod hygiene;
pub mod assumptions;
pub mod helpers;
#[doc(hidden)]
pub mod native;
pub mod perf;
pub mod quote;
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/ext.rs | crates/swc_ecma_transforms_base/src/ext.rs | //! Do not use: This is not a public api and it can be changed without a version
//! bump.
use swc_ecma_ast::*;
use swc_ecma_utils::ExprExt;
pub trait ExprRefExt: ExprExt {
fn as_ident(&self) -> Option<&Ident> {
match self.as_expr() {
Expr::Ident(ref i) => Some(i),
_ => None,
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/tests.rs | crates/swc_ecma_transforms_base/src/tests.rs | use swc_common::{
comments::SingleThreadedComments,
errors::{Handler, HANDLER},
sync::Lrc,
FileName, SourceMap,
};
use swc_ecma_ast::*;
use swc_ecma_codegen::Emitter;
use swc_ecma_parser::{error::Error, lexer::Lexer, Parser, StringInput, Syntax};
use swc_ecma_utils::DropSpan;
use swc_ecma_visit::{Fold, ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/assumptions.rs | crates/swc_ecma_transforms_base/src/assumptions.rs | use serde::{Deserialize, Serialize};
/// Alternative for https://babeljs.io/docs/en/assumptions
///
/// All fields default to `false`.
#[derive(
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
)]
#[non_exhaustive]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pu... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/native.rs | crates/swc_ecma_transforms_base/src/native.rs | //! Module to check if an identifier is native word.
use phf::phf_set;
macro_rules! native {
(
$(
$i:tt
),*
) => {
/// Is `sym` a native **class**?
pub fn is_native(sym: &str) -> bool {
static SET: phf::Set<&'static str> = phf_set! {
$(
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/perf.rs | crates/swc_ecma_transforms_base/src/perf.rs | use swc_common::util::move_map::MoveMap;
#[cfg(feature = "concurrent")]
use swc_common::{errors::HANDLER, GLOBALS};
use swc_ecma_ast::*;
pub use swc_ecma_utils::parallel::*;
use swc_ecma_visit::{Fold, FoldWith, Visit, VisitMut, VisitMutWith, VisitWith};
#[cfg(feature = "concurrent")]
use crate::helpers::Helpers;
#[cfg... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/fixer.rs | crates/swc_ecma_transforms_base/src/fixer.rs | use std::{hash::BuildHasherDefault, mem, ops::RangeFull};
use indexmap::IndexMap;
use rustc_hash::FxHasher;
use swc_common::{comments::Comments, util::take::Take, Span, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_utils::stack_size::maybe_grow_default;
use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass,... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/scope.rs | crates/swc_ecma_transforms_base/src/scope.rs | use swc_ecma_ast::VarDeclKind;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ScopeKind {
Block,
#[default]
Fn,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IdentType {
Binding,
Ref,
Label,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DeclKind {
Lexic... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/quote.rs | crates/swc_ecma_transforms_base/src/quote.rs | /// Not a public api.
#[doc(hidden)]
#[macro_export]
macro_rules! helper_expr {
(ts, $field_name:ident) => {{
$crate::helper_expr!(ts, ::swc_common::DUMMY_SP, $field_name)
}};
(ts, $span:expr, $field_name:ident) => {{
use swc_ecma_utils::{quote_ident, ExprFactory};
let mark = $crat... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/helpers/mod.rs | crates/swc_ecma_transforms_base/src/helpers/mod.rs | use std::cell::RefCell;
use swc_atoms::atom;
use swc_common::{Mark, SyntaxContext, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_utils::{prepend_stmts, quote_ident, DropSpan, ExprFactory};
use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut, VisitMutWith};
#[macro_export]
macro_rules! enable_helper {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/analyer_and_collector.rs | crates/swc_ecma_transforms_base/src/rename/analyer_and_collector.rs | use std::hash::Hash;
use rustc_hash::FxHashSet;
use swc_atoms::Atom;
use swc_common::{Mark, SyntaxContext};
use swc_ecma_ast::*;
use swc_ecma_utils::{ident::IdentLike, stack_size::maybe_grow_default};
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use super::{analyzer::scope::Scope, Analyzer};
struct IdCol... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/mod.rs | crates/swc_ecma_transforms_base/src/rename/mod.rs | use std::{borrow::Cow, collections::hash_map::Entry};
use analyer_and_collector::AnalyzerAndCollector;
use rustc_hash::{FxHashMap, FxHashSet};
use swc_atoms::Atom;
use swc_common::{Mark, SyntaxContext};
use swc_ecma_ast::*;
use swc_ecma_utils::stack_size::maybe_grow_default;
use swc_ecma_visit::{noop_visit_mut_type, v... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/eval.rs | crates/swc_ecma_transforms_base/src/rename/eval.rs | use swc_ecma_ast::*;
use swc_ecma_utils::stack_size::maybe_grow_default;
use swc_ecma_visit::{noop_visit_type, visit_obj_and_computed, Visit, VisitWith};
pub fn contains_eval<N>(node: &N, include_with: bool) -> bool
where
N: VisitWith<EvalFinder>,
{
let mut v = EvalFinder {
found: false,
includ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/ops.rs | crates/swc_ecma_transforms_base/src/rename/ops.rs | use rustc_hash::FxHashMap;
use swc_common::{
util::{move_map::MoveMap, take::Take},
Spanned, SyntaxContext, DUMMY_SP,
};
use swc_ecma_ast::*;
use swc_ecma_utils::stack_size::maybe_grow_default;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use crate::{
hygiene::Config,
perf::{cpu_c... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs | crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs | #![allow(clippy::too_many_arguments)]
use std::{hash::BuildHasherDefault, mem::take};
use indexmap::IndexSet;
#[cfg(feature = "concurrent-renamer")]
use par_iter::prelude::*;
use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
use swc_atoms::{atom, Atom};
use swc_common::Mark;
use swc_ecma_ast::*;
use tracing::debug;
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/analyzer/mod.rs | crates/swc_ecma_transforms_base/src/rename/analyzer/mod.rs | use swc_common::Mark;
use swc_ecma_ast::*;
use self::scope::{Scope, ScopeKind};
mod reverse_map;
pub(super) mod scope;
#[derive(Debug, Default)]
pub(super) struct Analyzer {
/// If `eval` exists for the current scope, we only rename synthesized
/// identifiers.
pub(super) has_eval: bool,
/// The [Mar... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/rename/analyzer/reverse_map.rs | crates/swc_ecma_transforms_base/src/rename/analyzer/reverse_map.rs | use rustc_hash::FxHashMap;
use swc_atoms::Atom;
use swc_ecma_ast::Id;
#[derive(Debug, Default)]
pub(crate) struct ReverseMap<'a> {
prev: Option<&'a ReverseMap<'a>>,
inner: FxHashMap<Atom, Vec<Id>>,
}
impl ReverseMap<'_> {
pub fn push_entry(&mut self, key: Atom, id: Id) {
self.inner.entry(key).or_... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/hygiene/tests.rs | crates/swc_ecma_transforms_base/src/hygiene/tests.rs | use rustc_hash::FxHashMap;
use swc_atoms::{atom, Atom};
use swc_common::{hygiene::*, DUMMY_SP};
use swc_ecma_parser::Syntax;
use swc_ecma_utils::quote_ident;
use swc_ecma_visit::{Fold, FoldWith};
use testing::{assert_eq, DebugUsingDisplay};
use super::*;
use crate::{
rename::renamer_keep_contexts,
tests::{Hygi... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/hygiene/mod.rs | crates/swc_ecma_transforms_base/src/hygiene/mod.rs | use swc_atoms::Atom;
use swc_common::Mark;
use swc_ecma_ast::*;
use swc_ecma_utils::stack_size::maybe_grow_default;
use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut, VisitMutWith};
pub use crate::rename::rename;
use crate::rename::{renamer, Renamer};
#[cfg(test)]
mod tests;
#[derive(Debug, Clone, D... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/resolver/tests.rs | crates/swc_ecma_transforms_base/src/resolver/tests.rs | use swc_atoms::atom;
use swc_ecma_parser::Syntax;
use super::*;
use crate::hygiene::Config;
// struct TsHygiene {
// top_level_mark: Mark,
// }
// impl VisitMut for TsHygiene {
// fn visit_mut_ident(&mut self, i: &mut Ident) {
// if SyntaxContext::empty().apply_mark(self.top_level_mark) ==
// i.ctxt ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/src/resolver/mod.rs | crates/swc_ecma_transforms_base/src/resolver/mod.rs | use rustc_hash::{FxHashMap, FxHashSet};
use swc_atoms::Atom;
use swc_common::{Mark, SyntaxContext};
use swc_ecma_ast::*;
use swc_ecma_utils::{find_pat_ids, stack_size::maybe_grow_default};
use swc_ecma_visit::{
noop_visit_mut_type, visit_mut_obj_and_computed, visit_mut_pass, VisitMut, VisitMutWith,
};
use tracing::... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/tests/ts_resolver.rs | crates/swc_ecma_transforms_base/tests/ts_resolver.rs | #![deny(warnings)]
use std::path::PathBuf;
use swc_common::{Mark, SyntaxContext};
use swc_ecma_ast::*;
use swc_ecma_parser::{parse_file_as_module, Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_visit::{Visit, VisitWith};
use testing::fixture;
#[fixture("../swc_ecma_parser/tests/**/*.ts")]
#[... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/tests/par.rs | crates/swc_ecma_transforms_base/tests/par.rs | use swc_ecma_ast::*;
use swc_ecma_transforms_base::perf::Parallel;
use swc_ecma_transforms_macros::parallel;
use swc_ecma_visit::{Fold, VisitMut};
#[derive(Default, Clone, Copy)]
struct ExampleVisitMut;
impl Parallel for ExampleVisitMut {
fn merge(&mut self, _: Self) {}
fn create(&self) -> Self {
Sel... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/tests/par_explode.rs | crates/swc_ecma_transforms_base/tests/par_explode.rs | use swc_ecma_ast::*;
use swc_ecma_transforms_base::perf::{ParExplode, Parallel};
use swc_ecma_transforms_macros::parallel;
use swc_ecma_visit::{Fold, VisitMut};
#[derive(Default, Clone, Copy)]
struct ExampleVisitMut;
impl Parallel for ExampleVisitMut {
fn merge(&mut self, _: Self) {}
fn create(&self) -> Self... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/tests/fixture.rs | crates/swc_ecma_transforms_base/tests/fixture.rs | use std::path::{Path, PathBuf};
use swc_common::{sync::Lrc, Mark, SourceMap, SyntaxContext};
use swc_ecma_ast::*;
use swc_ecma_codegen::Emitter;
use swc_ecma_parser::{lexer::Lexer, EsSyntax, Parser, StringInput, Syntax, TsSyntax};
use swc_ecma_transforms_base::{fixer::fixer, resolver};
use swc_ecma_visit::{visit_mut_o... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/tests/fixer_test262.rs | crates/swc_ecma_transforms_base/tests/fixer_test262.rs | #![feature(test)]
extern crate test;
use std::{
env,
fs::{read_dir, File},
io::{self, Read, Write},
path::Path,
sync::{Arc, RwLock},
};
use swc_atoms::atom;
use swc_ecma_ast::*;
use swc_ecma_codegen::Emitter;
use swc_ecma_parser::{lexer::Lexer, Parser, Syntax};
use swc_ecma_transforms_base::fixer:... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_base/benches/base.rs | crates/swc_ecma_transforms_base/benches/base.rs | #![allow(clippy::redundant_closure_call)]
extern crate swc_malloc;
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc_common::{errors::HANDLER, FileName, Mark};
use swc_ecma_ast::Program;
use swc_ecma_parser::{Parser, StringInput, Syntax};
use swc_ecma_transforms_... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_xml_codegen_macros/src/lib.rs | crates/swc_xml_codegen_macros/src/lib.rs | #![deny(clippy::all)]
extern crate proc_macro;
use quote::ToTokens;
use syn::{parse_quote, FnArg, ImplItemFn, Type, TypeReference};
#[proc_macro_attribute]
pub fn emitter(
_attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let item: ImplItemFn = syn::parse(item)... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin/src/lib.rs | crates/swc_plugin/src/lib.rs | #![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(target_arch = "wasm32")]
pub mod allocation;
pub mod pseudo_scoped_key;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin/src/allocation.rs | crates/swc_plugin/src/allocation.rs | use std::alloc::{alloc as global_alloc, dealloc as global_dealloc, Layout};
/// Allocate bytes that won't be dropped by the allocator.
/// Return the pointer to the leaked allocation so the host can write to it.
///
/// Note: Can be bit confusing but alloc / free should be called in host even
/// though this fn is exp... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin/src/pseudo_scoped_key.rs | crates/swc_plugin/src/pseudo_scoped_key.rs | use once_cell::sync::OnceCell;
/// Simple substitution for scoped_thread_local with limited interface parity.
///
/// The only available fn in this struct is `with`, which is being used for the
/// consumers when they need to access global scope handler (HANDLER.with()).
/// Any other interfaces to support thread loca... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/lib.rs | crates/swc_estree_compat/src/lib.rs | #![deny(clippy::all)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::upper_case_acronyms)]
use std::convert::Infallible;
pub mod babelify;
pub mod swcify;
pub type Never = Infallible;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/decl.rs | crates/swc_estree_compat/src/babelify/decl.rs | use copyless::BoxHelper;
use swc_ecma_ast::{ClassDecl, Decl, FnDecl, UsingDecl, VarDecl, VarDeclKind, VarDeclarator};
use swc_estree_ast::{
ClassBody, ClassDeclaration, Declaration, FunctionDeclaration, UsingDeclaration,
VariableDeclaration, VariableDeclarationKind, VariableDeclarator,
};
use crate::babelify::... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/expr.rs | crates/swc_estree_compat/src/babelify/expr.rs | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_atoms::atom;
use swc_common::{BytePos, Span, Spanned};
use swc_ecma_ast::{
ArrayLit, ArrowExpr, AssignExpr, AssignTarget, AssignTargetPat, AwaitExpr, BinExpr, BinaryOp,
BlockStmtOrExpr, CallExpr, Callee, ClassExpr, CondExpr, Expr, ExprOrSprea... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/pat.rs | crates/swc_estree_compat/src/babelify/pat.rs | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_common::Spanned;
use swc_ecma_ast::{
ArrayPat, AssignPat, AssignPatProp, KeyValuePatProp, ObjectPat, ObjectPatProp, Pat, RestPat,
};
use swc_estree_ast::{
ArrayPattern, AssignmentPattern, AssignmentPatternLeft, CatchClauseParam, Expression,
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/module.rs | crates/swc_estree_compat/src/babelify/module.rs | use serde::{Deserialize, Serialize};
use swc_common::{comments::Comment, Span};
use swc_ecma_ast::{Module, ModuleItem, Program, Script};
use swc_ecma_visit::{Visit, VisitWith};
use swc_estree_ast::{
flavor::Flavor, BaseNode, File, InterpreterDirective, LineCol, Loc, ModuleDeclaration,
Program as BabelProgram, S... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/operators.rs | crates/swc_estree_compat/src/babelify/operators.rs | use serde::{Deserialize, Serialize};
use swc_ecma_ast::{AssignOp, BinaryOp, UnaryOp, UpdateOp};
use swc_estree_ast::{BinaryExprOp, LogicalExprOp, UnaryExprOp, UpdateExprOp};
use crate::babelify::{Babelify, Context};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum BinaryOpOutput {
BinOp(BinaryExprOp),
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/typescript.rs | crates/swc_estree_compat/src/babelify/typescript.rs | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::Spanned;
use swc_ecma_ast::{
Accessibility, Expr, MemberProp, Pat, TruePlusMinus, TsArrayType, TsAsExpr,
TsCallSignatureDecl, TsConditionalType, TsConstAssertion, TsConstructSignatureDecl,
TsConstructorType, T... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/class.rs | crates/swc_estree_compat/src/babelify/class.rs | use copyless::BoxHelper;
use serde_json::value::Value;
use swc_ecma_ast::{
Class, ClassMember, ClassMethod, ClassProp, Constructor, Decorator, MethodKind, PrivateMethod,
PrivateProp, StaticBlock,
};
use swc_estree_ast::{
ClassBody, ClassBodyEl, ClassExpression, ClassMethod as BabelClassMethod, ClassMethodKi... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/function.rs | crates/swc_estree_compat/src/babelify/function.rs | use copyless::BoxHelper;
use swc_ecma_ast::{Function, Param, ParamOrTsParamProp, Pat};
use swc_estree_ast::{
ArrayPattern, AssignmentPattern, FunctionExpression, Identifier, ObjectPattern,
Param as BabelParam, Pattern, RestElement,
};
use crate::babelify::{Babelify, Context};
impl Babelify for Function {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/lit.rs | crates/swc_estree_compat/src/babelify/lit.rs | use serde::{Deserialize, Serialize};
use swc_atoms::atom;
use swc_ecma_ast::{BigInt, Bool, Lit, Null, Number, Regex, Str};
use swc_estree_ast::{
BigIntLiteral, BooleanLiteral, JSXText as BabelJSXText, Literal, NullLiteral, NumericLiteral,
RegExpLiteral, StringLiteral,
};
use crate::babelify::{Babelify, Context... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/prop.rs | crates/swc_estree_compat/src/babelify/prop.rs | use copyless::BoxHelper;
use swc_common::Spanned;
use swc_ecma_ast::{
AssignProp, ComputedPropName, GetterProp, KeyValueProp, MethodProp, Prop, PropName, SetterProp,
};
use swc_estree_ast::{
AssignmentPattern, AssignmentPatternLeft, Expression, FunctionExpression, ObjectKey,
ObjectMember, ObjectMethod, Obje... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/ident.rs | crates/swc_estree_compat/src/babelify/ident.rs | use copyless::BoxHelper;
use swc_ecma_ast::{BindingIdent, Ident, IdentName, PrivateName};
use swc_estree_ast::{Identifier, PrivateName as BabelPrivateName};
use crate::babelify::{Babelify, Context};
impl Babelify for BindingIdent {
type Output = Identifier;
fn babelify(self, ctx: &Context) -> Self::Output {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/module_decl.rs | crates/swc_estree_compat/src/babelify/module_decl.rs | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_ecma_ast::{
DefaultDecl, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr,
ExportDefaultSpecifier, ExportNamedSpecifier, ExportNamespaceSpecifier, ExportSpecifier, Expr,
ImportDecl, ImportDefaultSpecifier, ImportNamedSpecifier,... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/mod.rs | crates/swc_estree_compat/src/babelify/mod.rs | use serde::{de::DeserializeOwned, Serialize};
use swc_common::{
comments::{CommentKind, Comments},
sync::Lrc,
BytePos, SourceFile, SourceMap, Span,
};
use swc_ecma_ast::Class;
use swc_estree_ast::{flavor::Flavor, BaseComment, BaseNode, Comment, CommentType, LineCol, Loc};
use swc_node_comments::SwcComments;... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/jsx.rs | crates/swc_estree_compat/src/babelify/jsx.rs | use copyless::BoxHelper;
use swc_common::{BytePos, Span, Spanned};
use swc_ecma_ast::{
JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment,
JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpr, JSXExpr, JSXExprContainer,
JSXFragment, JSXMemberExpr, JSXNamespacedNa... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/babelify/stmt.rs | crates/swc_estree_compat/src/babelify/stmt.rs | use copyless::BoxHelper;
use swc_ecma_ast::{
BlockStmt, BreakStmt, CatchClause, ContinueStmt, DebuggerStmt, Decl, DoWhileStmt, EmptyStmt,
ExprStmt, ForHead, ForInStmt, ForOfStmt, ForStmt, IfStmt, LabeledStmt, ReturnStmt, Stmt,
SwitchCase, SwitchStmt, ThrowStmt, TryStmt, VarDeclOrExpr, WhileStmt, WithStmt,
}... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/expr.rs | crates/swc_estree_compat/src/swcify/expr.rs | use swc_common::Spanned;
use swc_ecma_ast::{
op, ArrayLit, ArrowExpr, AssignExpr, AwaitExpr, BinExpr, BinaryOp, BindingIdent,
BlockStmtOrExpr, CallExpr, Callee, ClassExpr, ComputedPropName, CondExpr, Expr, ExprOrSpread,
FnExpr, Function, Ident, Import, JSXAttr, JSXAttrOrSpread, JSXAttrValue, JSXEmptyExpr, J... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/pat.rs | crates/swc_estree_compat/src/swcify/pat.rs | use swc_common::Spanned;
use swc_ecma_ast::*;
use swc_estree_ast::{
ArrayPattern, AssignmentPattern, AssignmentPatternLeft, LVal, ObjectPattern, ObjectPatternProp,
PatternLike, RestElement,
};
use crate::swcify::{Context, Swcify};
impl Swcify for LVal {
type Output = Pat;
fn swcify(self, ctx: &Contex... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/program.rs | crates/swc_estree_compat/src/swcify/program.rs | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false | |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/typescript.rs | crates/swc_estree_compat/src/swcify/typescript.rs | use swc_ecma_ast::{
Accessibility, Ident, TsEntityName, TsQualifiedName, TsType, TsTypeAnn, TsTypeParam,
TsTypeParamDecl, TsTypeParamInstantiation,
};
use swc_estree_ast::{
Access, FlowType, SuperTypeParams, TSEntityName, TSQualifiedName, TSType, TSTypeAnnotation,
TSTypeParameter, TSTypeParameterDeclara... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/class.rs | crates/swc_estree_compat/src/swcify/class.rs | use swc_ecma_ast::{
ClassMember, Expr, Function, MemberExpr, MemberProp, MethodKind, ParamOrTsParamProp,
TsExprWithTypeArgs,
};
use swc_estree_ast::{
ClassBody, ClassBodyEl, ClassImpl, ClassMethodKind, TSEntityName,
TSExpressionWithTypeArguments, TSQualifiedName,
};
use super::Context;
use crate::swcif... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/lit.rs | crates/swc_estree_compat/src/swcify/lit.rs | use swc_ecma_ast::{BigInt, Bool, Expr, Lit, Null, Number, Regex, Str, Tpl, TplElement};
use swc_estree_ast::{
BigIntLiteral, BooleanLiteral, DecimalLiteral, Literal, NullLiteral, NumberLiteral,
NumericLiteral, RegExpLiteral, StringLiteral, TemplateElement, TemplateLiteral,
TemplateLiteralExpr,
};
use super... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/mod.rs | crates/swc_estree_compat/src/swcify/mod.rs | use std::fmt::Debug;
pub use self::ctx::Context;
mod class;
mod ctx;
mod expr;
mod jsx;
mod lit;
mod pat;
mod program;
mod stmt;
mod typescript;
/// Used to convert a babel ast node to
pub trait Swcify {
type Output: Debug + Send + Sync;
fn swcify(self, ctx: &Context) -> Self::Output;
}
impl<T> Swcify for ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/ctx.rs | crates/swc_estree_compat/src/swcify/ctx.rs | use swc_common::{sync::Lrc, BytePos, FileName, SourceFile, SourceMap, Span, DUMMY_SP};
use swc_estree_ast::{BaseNode, LineCol, Loc};
use swc_node_comments::SwcComments;
pub struct Context {
#[allow(unused)]
pub(crate) cm: Lrc<SourceMap>,
pub(crate) fm: Lrc<SourceFile>,
#[allow(unused)]
pub(crate) c... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/jsx.rs | crates/swc_estree_compat/src/swcify/jsx.rs | use swc_ecma_ast::Ident;
use crate::swcify::{Context, Swcify};
impl Swcify for swc_estree_ast::JSXNamespacedName {
type Output = swc_ecma_ast::JSXNamespacedName;
fn swcify(self, ctx: &Context) -> Self::Output {
swc_ecma_ast::JSXNamespacedName {
span: ctx.span(&self.base),
ns: ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/src/swcify/stmt.rs | crates/swc_estree_compat/src/swcify/stmt.rs | use swc_common::DUMMY_SP;
use swc_ecma_ast::{
BlockStmt, BreakStmt, ClassDecl, ClassExpr, ContinueStmt, DebuggerStmt, DefaultDecl,
DoWhileStmt, EmptyStmt, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr,
ExportNamedSpecifier, ExprStmt, FnDecl, FnExpr, ForHead, ForInStmt, ForOfStmt, ForStmt, IfSt... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/tests/flavor.rs | crates/swc_estree_compat/tests/flavor.rs | use std::{
path::{Path, PathBuf},
process::{Command, Stdio},
};
use anyhow::Context;
use serde_json::{Number, Value};
use swc::SwcComments;
use swc_ecma_ast::EsVersion;
use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax};
use swc_estree_ast::flavor::Flavor;
use swc_estree_compat::babelify::Babelif... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/tests/convert.rs | crates/swc_estree_compat/tests/convert.rs | #![feature(test)]
extern crate test;
use std::{
env, fs,
path::{Path, PathBuf},
sync::Arc,
};
use anyhow::{Context as AnyhowContext, Error};
use copyless::BoxHelper;
use pretty_assertions::assert_eq;
use serde_json::{Number, Value};
use swc::{config::IsModule, Compiler};
use swc_common::{
errors::{Col... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_estree_compat/benches/babelify.rs | crates/swc_estree_compat/benches/babelify.rs | use std::{io::stderr, sync::Arc};
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc::config::IsModule;
use swc_common::{
errors::Handler, FileName, FilePathMapping, Mark, SourceFile, SourceMap, GLOBALS,
};
use swc_ecma_ast::{EsVersion, Program};
use swc_ecma_p... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_eq_ignore_macros/src/lib.rs | crates/swc_eq_ignore_macros/src/lib.rs | use proc_macro2::Span;
use quote::quote;
use syn::{
parse, parse_quote, punctuated::Punctuated, spanned::Spanned, Arm, BinOp, Block, Data,
DeriveInput, Expr, ExprBinary, ExprBlock, Field, FieldPat, Fields, Ident, Index, Member, Pat,
PatIdent, PatRest, PatStruct, PatTuple, Path, Stmt, Token,
};
/// Derives ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_allocator/src/lib.rs | crates/swc_allocator/src/lib.rs | //! Allocator for swc.
//!
//! # Features
//!
//! - `scoped`: Enable `scoped` mode.
//!
//! # Modes
//!
//! ## Default mode
//!
//! In default mode, [crate::boxed::Box] and [crate::vec::Vec] are identical to
//! the original types in [std].
//!
//! ## Scoped mode
//!
//! - You need to enable `scoped` feature to use thi... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_allocator/src/util.rs | crates/swc_allocator/src/util.rs | #![allow(unused_imports)]
#[cfg(feature = "nightly")]
pub use std::alloc::Allocator;
#[cfg(not(feature = "nightly"))]
pub use allocator_api2::alloc::Allocator;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_allocator/src/allocators/global.rs | crates/swc_allocator/src/allocators/global.rs | #[cfg(feature = "nightly")]
pub use std::alloc::Global;
#[cfg(not(feature = "nightly"))]
pub use allocator_api2::alloc::Global;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_allocator/src/allocators/arena.rs | crates/swc_allocator/src/allocators/arena.rs | use std::ops::{Deref, DerefMut};
use bumpalo::Bump;
/// Arena allocator
#[derive(Default)]
pub struct Arena {
inner: Bump,
}
impl Deref for Arena {
type Target = Bump;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl DerefMut for Arena {
fn deref_mut(&mut self) -> &mut Self::Targ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_allocator/src/allocators/scoped.rs | crates/swc_allocator/src/allocators/scoped.rs | /// Scoped allocator
pub struct Scoped;
#[cfg(feature = "nightly")]
unsafe impl std::alloc::Allocator for Scoped {
fn allocate(
&self,
_layout: std::alloc::Layout,
) -> Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError> {
todo!()
}
unsafe fn deallocate(&self, _ptr: std::pt... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.