Files
jsrt/lib/stdlib/globals.js
T
2026-10-03 14:06:24 +00:00

20 lines
855 B
JavaScript

// The stdlib, compiled in front of every program. Its files are joined in the
// order of `STDLIB` in compiler/src/main.rs, and this one is first
//
// Built on the natives in compiler/src/native.rs, the common layer of
// operations on primitive values. The compiler's own code for operators (`+` on
// strings and so on) uses those natives directly, not these functions.
//
// Restrictions:
// - The prototypes linked with `__link_proto_*` are fixed. User code may not
// change them (no monkey-patching)
// - `new String(x)`, `new Number(x)` and `new Boolean(x)` (wrapper objects) are
// not supported. These functions only convert
//
// Needs `typeof`. `String.prototype.concat` is not here, because it needs rest
// params, which need arrays. `console.log` prints one arg only, for the same
// reason
const NaN = 0 / 0;
const Infinity = 1 / 0;