porffor 0.56.3 → 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.
@@ -6320,6 +6320,12 @@ const generateTaggedTemplate = (scope, decl, global = false, name = undefined, v
6320
6320
  return out;
6321
6321
  },
6322
6322
 
6323
+ __Porffor_c: str => {
6324
+ return [
6325
+ [ null, 'c', str ]
6326
+ ];
6327
+ },
6328
+
6323
6329
  __Porffor_bs: str => makeString(scope, str, true),
6324
6330
  __Porffor_s: str => makeString(scope, str, false)
6325
6331
  };
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.3",
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,16 +1,109 @@
1
- class C {
2
- // static #method = () => 1;
3
- static #method() {
4
- return 'Test262';
1
+ var assert = mustBeTrue => {
2
+ if (mustBeTrue === true) {
3
+ return;
5
4
  }
6
5
 
7
- static getPrivateMethod() {
8
- this.#method = () => 2;
9
- return this.#method();
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]);
10
66
  }
11
67
  }
12
68
 
13
- console.log(C.getPrivateMethod())
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
+
93
+
94
+ // class C {
95
+ // // static #method = () => 1;
96
+ // static #method() {
97
+ // return 'Test262';
98
+ // }
99
+
100
+ // static getPrivateMethod() {
101
+ // this.#method = () => 2;
102
+ // return this.#method();
103
+ // }
104
+ // }
105
+
106
+ // console.log(C.getPrivateMethod())
14
107
 
15
108
  // var __assert_throws = (expectedErrorConstructor, func) => {
16
109
  // if (typeof func !== 'function') {
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.3';
3
+ globalThis.version = '0.56.5';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
package/foo DELETED
File without changes