Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
29
third-party/vendor/swc_atoms/build.rs
vendored
Normal file
29
third-party/vendor/swc_atoms/build.rs
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
use std::{env, path::Path};
|
||||
|
||||
fn main() {
|
||||
let strs = include_str!("words.txt")
|
||||
.lines()
|
||||
.map(|l| l.trim())
|
||||
.collect::<Vec<_>>();
|
||||
gen("js_word", "JsWord", &strs);
|
||||
}
|
||||
|
||||
fn gen(mac_name: &str, type_name: &str, atoms: &[&str]) {
|
||||
string_cache_codegen::AtomType::new(type_name, &format!("{}!", mac_name))
|
||||
.atoms(atoms)
|
||||
.with_atom_doc(
|
||||
"
|
||||
[JsWord] is an interned string.
|
||||
|
||||
This type should be used instead of [String] for values, because lots of
|
||||
values are duplicated. For example, if an identifier is named `myVariable`,
|
||||
there will be lots of identifier usages with the value `myVariable`.
|
||||
|
||||
This type
|
||||
- makes equality comparison faster.
|
||||
- reduces memory usage.
|
||||
",
|
||||
)
|
||||
.write_to_file(&Path::new(&env::var("OUT_DIR").unwrap()).join(format!("{}.rs", mac_name)))
|
||||
.unwrap();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue