porffor 0.56.4 → 0.56.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "An ahead-of-time JavaScript compiler",
4
- "version": "0.56.4",
4
+ "version": "0.56.5",
5
5
  "author": "Oliver Medhurst <honk@goose.icu>",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/r.cjs CHANGED
@@ -1,4 +1,95 @@
1
- Porffor.printString(TypeError('foo').toString());
1
+ var assert = mustBeTrue => {
2
+ if (mustBeTrue === true) {
3
+ return;
4
+ }
5
+
6
+ throw new Test262Error('assert failed');
7
+ };
8
+ assert; // idk why exactly but this fixes many tests by forcing indirect ref
9
+
10
+ var __assert_throws = (expectedErrorConstructor, func) => {
11
+ if (typeof func !== 'function') {
12
+ throw new Test262Error('assert.throws invoked with a non-function value');
13
+ }
14
+
15
+ try {
16
+ func();
17
+ } catch {
18
+ return;
19
+ }
20
+
21
+ throw new Test262Error('assert.throws failed');
22
+ };
23
+
24
+ var __assert__isSameValue = (a, b) => {
25
+ if (a === b) {
26
+ // Handle +/-0 vs. -/+0
27
+ return a !== 0 || 1 / a === 1 / b;
28
+ }
29
+
30
+ // Handle NaN vs. NaN
31
+ return a !== a && b !== b;
32
+ };
33
+
34
+ var __assert_sameValue = (actual, expected) => {
35
+ if (assert._isSameValue(actual, expected)) {
36
+ return;
37
+ }
38
+
39
+ throw new Test262Error('assert.sameValue failed');
40
+ };
41
+
42
+ var __assert_notSameValue = (actual, unexpected) => {
43
+ if (!assert._isSameValue(actual, unexpected)) {
44
+ return;
45
+ }
46
+
47
+ throw new Test262Error('assert.notSameValue failed');
48
+ };
49
+
50
+ var typedArrayConstructors = [
51
+ Float64Array,
52
+ Float32Array,
53
+ Int32Array,
54
+ Int16Array,
55
+ Int8Array,
56
+ Uint32Array,
57
+ Uint16Array,
58
+ Uint8Array,
59
+ Uint8ClampedArray
60
+ ];
61
+
62
+ function testWithTypedArrayConstructors(f, selected) {
63
+ var constructors = selected || typedArrayConstructors;
64
+ for (var i = 0; i < constructors.length; ++i) {
65
+ f(constructors[i]);
66
+ }
67
+ }
68
+
69
+ testWithTypedArrayConstructors(function(TA) {
70
+ var sample = new TA([40, 41, 42, 43]);
71
+
72
+ function testRes(result, msg) {
73
+ assert.sameValue(result.length, 4, msg);
74
+ assert.sameValue(result[0], 40, msg + " & result[0] === 40");
75
+ assert.sameValue(result[1], 41, msg + " & result[1] === 41");
76
+ assert.sameValue(result[2], 42, msg + " & result[2] === 42");
77
+ assert.sameValue(result[3], 43, msg + " & result[3] === 43");
78
+ }
79
+
80
+ testRes(sample.subarray(0), "begin == 0");
81
+ testRes(sample.subarray(-4), "begin == -srcLength");
82
+ testRes(sample.subarray(-5), "begin < -srcLength");
83
+
84
+ testRes(sample.subarray(0, 4), "begin == 0, end == srcLength");
85
+ testRes(sample.subarray(-4, 4), "begin == -srcLength, end == srcLength");
86
+ testRes(sample.subarray(-5, 4), "begin < -srcLength, end == srcLength");
87
+
88
+ testRes(sample.subarray(0, 5), "begin == 0, end > srcLength");
89
+ testRes(sample.subarray(-4, 5), "begin == -srcLength, end > srcLength");
90
+ testRes(sample.subarray(-5, 5), "begin < -srcLength, end > srcLength");
91
+ });
92
+
2
93
 
3
94
  // class C {
4
95
  // // static #method = () => 1;
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.56.4';
3
+ globalThis.version = '0.56.5';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {