fromCodePoint

This commit is contained in:
Andrew Morris
2023-03-13 14:25:55 +11:00
parent 11e77f36bd
commit 253b06141c
9 changed files with 138 additions and 18 deletions

View File

@@ -329,6 +329,7 @@ impl Assembler {
let builtin_code = match builtin.name.as_str() {
"Math" => 0,
"Debug" => 1,
"String" => 2,
_ => panic!("Unknown builtin: {}", builtin.name),
};

View File

@@ -747,13 +747,16 @@ impl<'a> AssemblyParser<'a> {
}
fn assemble_builtin(&mut self) -> Builtin {
match self.parse_one_of(&["$Math", "$Debug"]).as_str() {
match self.parse_one_of(&["$Math", "$Debug", "$String"]).as_str() {
"$Math" => Builtin {
name: "Math".to_string(),
},
"$Debug" => Builtin {
name: "Debug".to_string(),
},
"$String" => Builtin {
name: "String".to_string(),
},
_ => panic!("Shouldn't happen"),
}
}

View File

@@ -95,6 +95,12 @@ pub fn init_std_scope() -> Scope {
name: "Debug".to_string(),
}),
),
(
"String".to_string(),
MappedName::Builtin(Builtin {
name: "String".to_string(),
}),
),
]),
parent: None,
})),

View File

@@ -57,7 +57,7 @@ impl ScopeAnalysis {
let mut sa = ScopeAnalysis::default();
let scope = init_std_scope();
for builtin_name in vec!["Debug", "Math"] {
for builtin_name in vec!["Debug", "Math", "String"] {
let builtin = Builtin {
name: builtin_name.to_string(),
};
@@ -1629,6 +1629,12 @@ fn init_std_scope() -> XScope {
name: "Debug".to_string(),
}),
),
(
swc_atoms::JsWord::from("String"),
NameId::Builtin(Builtin {
name: "String".to_string(),
}),
),
]),
parent: None,
}))