mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
number_builtin
This commit is contained in:
@@ -330,6 +330,7 @@ impl Assembler {
|
||||
"Math" => 0,
|
||||
"Debug" => 1,
|
||||
"String" => 2,
|
||||
"Number" => 3,
|
||||
_ => panic!("Unknown builtin: {}", builtin.name),
|
||||
};
|
||||
|
||||
|
||||
@@ -747,7 +747,10 @@ impl<'a> AssemblyParser<'a> {
|
||||
}
|
||||
|
||||
fn assemble_builtin(&mut self) -> Builtin {
|
||||
match self.parse_one_of(&["$Math", "$Debug", "$String"]).as_str() {
|
||||
match self
|
||||
.parse_one_of(&["$Math", "$Debug", "$String", "$Number"])
|
||||
.as_str()
|
||||
{
|
||||
"$Math" => Builtin {
|
||||
name: "Math".to_string(),
|
||||
},
|
||||
@@ -757,6 +760,9 @@ impl<'a> AssemblyParser<'a> {
|
||||
"$String" => Builtin {
|
||||
name: "String".to_string(),
|
||||
},
|
||||
"$Number" => Builtin {
|
||||
name: "Number".to_string(),
|
||||
},
|
||||
_ => panic!("Shouldn't happen"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,12 @@ pub fn init_std_scope() -> Scope {
|
||||
name: "String".to_string(),
|
||||
}),
|
||||
),
|
||||
(
|
||||
"Number".to_string(),
|
||||
MappedName::Builtin(Builtin {
|
||||
name: "Number".to_string(),
|
||||
}),
|
||||
),
|
||||
]),
|
||||
parent: None,
|
||||
})),
|
||||
|
||||
@@ -57,7 +57,7 @@ impl ScopeAnalysis {
|
||||
let mut sa = ScopeAnalysis::default();
|
||||
let scope = init_std_scope();
|
||||
|
||||
for builtin_name in vec!["Debug", "Math", "String"] {
|
||||
for builtin_name in vec!["Debug", "Math", "String", "Number"] {
|
||||
let builtin = Builtin {
|
||||
name: builtin_name.to_string(),
|
||||
};
|
||||
@@ -1635,6 +1635,12 @@ fn init_std_scope() -> XScope {
|
||||
name: "String".to_string(),
|
||||
}),
|
||||
),
|
||||
(
|
||||
swc_atoms::JsWord::from("Number"),
|
||||
NameId::Builtin(Builtin {
|
||||
name: "Number".to_string(),
|
||||
}),
|
||||
),
|
||||
]),
|
||||
parent: None,
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user