This commit is contained in:
Leah Lundqvist 2020-12-08 17:49:20 +01:00 committed by GitHub
parent a2ec52b8c4
commit 90c1c639fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 476 additions and 223 deletions

View file

@ -7,6 +7,23 @@
module builtin
pub struct JS.Number {}
pub struct JS.String {
length JS.Number
}
pub struct JS.Boolean {}
pub struct JS.Array {}
pub struct JS.Map {}
// Type prototype functions
fn (v JS.String) toString() JS.String
fn (v JS.Number) toString() JS.String
fn (v JS.Boolean) toString() JS.String
fn (v JS.Array) toString() JS.String
fn (v JS.Map) toString() JS.String
fn (v JS.String) slice(a int, b int) JS.String
// Top level functions
fn JS.eval(string) any
fn JS.parseInt(string, f64) f64
@ -63,3 +80,7 @@ fn JS.Math.round(f64) f64
fn JS.Math.sin(f64) f64
fn JS.Math.sqrt(f64) f64
fn JS.Math.tan(f64) f64
// JSON
fn JS.JSON.stringify(any) string
fn JS.JSON.parse(string) any