mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
ea610c6ded
swc_atoms: - add some atoms swc_ecma_ast: - ast nodes for typescript - `ClassMethod` -> `Method`, `ClassMethodKind` -> `MethodKind` - private class method / class property - use separate type for tagged template literals - add `declare` field to `Decl`s - make function body optional swc_ecma_parser: - rename Type to TokenContext - support decorators Note: error reporting for invalid decorator is not implemented yet - merge `Config` into `Syntax` - Use DiagnosticBuilder for error type This is to make backtracking cheaper. swc_ecma_transforms: - add `strip` pass
19 lines
510 B
Rust
19 lines
510 B
Rust
extern crate string_cache_codegen;
|
|
|
|
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)
|
|
.write_to_file(&Path::new(&env::var("OUT_DIR").unwrap()).join(format!("{}.rs", mac_name)))
|
|
.unwrap();
|
|
}
|