porffor 0.16.0-e5b6b94c8 โ 0.16.0-fe07da0f4
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/CONTRIBUTING.md
CHANGED
@@ -206,6 +206,7 @@ Store the character code into the `out` pointer variable, and increment it.
|
|
206
206
|
- You cannot use other functions in the file not exported, or variables not inside the current function.
|
207
207
|
- `if (...)` uses a fast truthy implementation which is not spec-compliant as most conditions should be strictly checked. To use spec-compliant behavior, use `if (Boolean(...))`.
|
208
208
|
- For object (string/array/etc) literals, you must use a variable eg `const out: bytestring = 'foobar'; console.log(out);` instead of `console.log('foobar')` due to precompile's allocator constraints.
|
209
|
+
- Generally prefer/use non-strict equality ops (`==`/`!=`).
|
209
210
|
|
210
211
|
<br>
|
211
212
|
|
@@ -246,7 +247,7 @@ The main thing you want to pay attention to is the emoji summary (lol):
|
|
246
247
|
To break this down:
|
247
248
|
๐งช total ๐ค pass โ fail ๐ runtime error ๐ todo (error) โฐ timeout ๐๏ธ wasm compile error ๐ฅ compile error
|
248
249
|
|
249
|
-
The diff compared to the last commit (with test262 data) is shown in brackets. Basically, you
|
250
|
+
The diff compared to the last commit (with test262 data) is shown in brackets. Basically, you want passes ๐ค up, and errors ๐๐๐๐ฅ down. It is fine if some errors change balance/etc, as long as they are not new failures.
|
250
251
|
|
251
252
|
It will also log new passes/fails. Be careful as sometimes the overall passes can increase, but other files have also regressed into failures which you might miss. Also keep in mind some tests may have been false positives before, but we can investigate the diff together :)
|
252
253
|
|
@@ -22,6 +22,14 @@ type PorfforGlobal = {
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
|
25
|
+
allocate(): any;
|
26
|
+
set: {
|
27
|
+
read(_this: any, index: number): i32;
|
28
|
+
write(_this: any, index: number, value: any): boolean;
|
29
|
+
}
|
30
|
+
|
31
|
+
print(x: any): i32;
|
32
|
+
|
25
33
|
randomByte(): i32;
|
26
34
|
|
27
35
|
type(x: any): bytestring;
|
package/compiler/builtins/set.ts
CHANGED
@@ -189,9 +189,10 @@ export const Set$constructor = (iterable: any): Set => {
|
|
189
189
|
|
190
190
|
export const __Set_prototype_union = (_this: Set, other: any) => {
|
191
191
|
if (Porffor.rawType(other) != Porffor.TYPES.set) {
|
192
|
-
throw new TypeError("Set.union
|
192
|
+
throw new TypeError("Set.prototype.union\'s \'other\' argument must be a Set");
|
193
193
|
}
|
194
|
-
|
194
|
+
|
195
|
+
const out: Set = Set$constructor(_this);
|
195
196
|
for (const x of other) {
|
196
197
|
out.add(x);
|
197
198
|
}
|
@@ -8,10 +8,10 @@ export const __Porffor_symbol_descStore = (op: boolean, value: any): any => {
|
|
8
8
|
Porffor.wasm.i32.store(ptr, size + 1, 0, 0)
|
9
9
|
|
10
10
|
// reuse set internals to store description
|
11
|
-
|
11
|
+
Porffor.set.write(ptr, size, value);
|
12
12
|
return size;
|
13
13
|
} else { // read
|
14
|
-
return
|
14
|
+
return Porffor.set.read(ptr, value);
|
15
15
|
}
|
16
16
|
};
|
17
17
|
|
@@ -21,8 +21,8 @@ export const Symbol = (description: any): Symbol => {
|
|
21
21
|
};
|
22
22
|
|
23
23
|
export const __Symbol_prototype_description$get = (_this: Symbol) => {
|
24
|
-
const description: bytestring =
|
25
|
-
Porffor.wasm`local.get ${_this}` - 1);
|
24
|
+
const description: bytestring =
|
25
|
+
__Porffor_symbol_descStore(false, Porffor.wasm`local.get ${_this}` - 1);
|
26
26
|
return description;
|
27
27
|
};
|
28
28
|
|
@@ -38,8 +38,8 @@ export const __Symbol_prototype_toString = (_this: Symbol) => {
|
|
38
38
|
Porffor.wasm.i32.store8(out, 108, 0, 9);
|
39
39
|
Porffor.wasm.i32.store8(out, 40, 0, 10);
|
40
40
|
|
41
|
-
const description: bytestring =
|
42
|
-
Porffor.wasm`local.get ${_this}` - 1);
|
41
|
+
const description: bytestring =
|
42
|
+
__Porffor_symbol_descStore(false, Porffor.wasm`local.get ${_this}` - 1);
|
43
43
|
|
44
44
|
const descLen: i32 = description.length;
|
45
45
|
let outPtr: i32 = Porffor.wasm`local.get ${out}` + 7;
|
package/compiler/codegen.js
CHANGED
@@ -2582,7 +2582,7 @@ const generateUnary = (scope, decl) => {
|
|
2582
2582
|
|
2583
2583
|
case '!':
|
2584
2584
|
const arg = decl.argument;
|
2585
|
-
if (arg.type ===
|
2585
|
+
if (arg.type === 'UnaryExpression' && arg.operator === '!') {
|
2586
2586
|
// !!x -> is x truthy
|
2587
2587
|
return truthy(scope, generate(scope, arg.argument), getNodeType(scope, arg.argument), false, false);
|
2588
2588
|
}
|
package/package.json
CHANGED