alpha
Login
or
Join now
nandi.uk
/
gleam
Star
2
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Fork of daniellemaywood.uk/gleam — Wasm codegen work
Star
2
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
use globalThis.Math.trunc
author
Giacomo Cavalieri
committer
Louis Pilfold
date
1 year ago
(Jul 15, 2025, 5:20 PM +0100)
commit
017fa757
017fa757405a4403055678151eabe37338e8730a
parent
fa0a1639
fa0a1639e3f323faaa8bc2069607479449ce6d89
+6
-6
6 changed files
Expand all
Collapse all
Unified
Split
compiler-core
src
javascript
expression.rs
tests
snapshots
gleam_core__javascript__tests__case_clause_guards__int_division.snap
gleam_core__javascript__tests__numbers__complex_division_by_non_zero_int.snap
gleam_core__javascript__tests__numbers__division_by_non_zero_int.snap
gleam_core__javascript__tests__numbers__int_divide_complex_expr.snap
gleam_core__javascript__tests__numbers__int_operators.snap
+1
-1
compiler-core/src/javascript/expression.rs
View file
Reviewed
···
1452
1452
} else {
1453
1453
docvec![left_doc, " / ", right_doc]
1454
1454
};
1455
1455
-
docvec!["Math.trunc", wrap_args([division])]
1455
1455
+
docvec!["globalThis.Math.trunc", wrap_args([division])]
1456
1456
} else {
1457
1457
self.tracker.int_division_used = true;
1458
1458
docvec!["divideInt", wrap_args([left_doc, right_doc])]
+1
-1
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__case_clause_guards__int_division.snap
View file
Reviewed
···
16
16
import { divideInt } from "../gleam.mjs";
17
17
18
18
export function main() {
19
19
-
let $ = Math.trunc(5 / 2);
19
19
+
let $ = globalThis.Math.trunc(5 / 2);
20
20
let x = $;
21
21
if (x === (divideInt(5, 2))) {
22
22
return true;
+1
-1
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__numbers__complex_division_by_non_zero_int.snap
View file
Reviewed
···
9
9
10
10
----- COMPILED JAVASCRIPT
11
11
export function main() {
12
12
-
return Math.trunc((1 + 2) / 3);
12
12
+
return globalThis.Math.trunc((1 + 2) / 3);
13
13
}
+1
-1
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__numbers__division_by_non_zero_int.snap
View file
Reviewed
···
9
9
10
10
----- COMPILED JAVASCRIPT
11
11
export function main() {
12
12
-
return Math.trunc(1 / 2);
12
12
+
return globalThis.Math.trunc(1 / 2);
13
13
}
+1
-1
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__numbers__int_divide_complex_expr.snap
View file
Reviewed
···
14
14
15
15
----- COMPILED JAVASCRIPT
16
16
export function go() {
17
17
-
return Math.trunc(
17
17
+
return globalThis.Math.trunc(
18
18
(() => {
19
19
let $ = 1 >= 0;
20
20
if ($) {
+1
-1
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__numbers__int_operators.snap
View file
Reviewed
···
21
21
export function go() {
22
22
1 + 1;
23
23
5 - 1;
24
24
-
Math.trunc(5 / 2);
24
24
+
globalThis.Math.trunc(5 / 2);
25
25
3 * 3;
26
26
5 % 2;
27
27
2 > 1;