porffor 0.34.6 → 0.34.8
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/compiler/assemble.js +8 -12
- package/compiler/builtins/crypto.ts +12 -1
- package/compiler/builtins/promise.ts +5 -5
- package/compiler/builtins.js +9 -9
- package/compiler/builtins_objects.js +1 -2
- package/compiler/builtins_precompiled.js +238 -233
- package/compiler/codegen.js +257 -157
- package/compiler/decompile.js +1 -1
- package/compiler/precompile.js +3 -3
- package/compiler/wrap.js +3 -2
- package/package.json +1 -1
- package/runner/index.js +1 -1
- package/runner/repl.js +1 -1
- package/r.js +0 -113
package/runner/repl.js
CHANGED
@@ -85,7 +85,7 @@ const run = (source, _context, _filename, callback, run = true) => {
|
|
85
85
|
let toRun = (prev ? (prev + `;\nprint(-0x1337);\n`) : '') + source;
|
86
86
|
|
87
87
|
let shouldPrint = !prev;
|
88
|
-
const { exports, pages } = compile(toRun, [], {}, str => {
|
88
|
+
const { exports, pages } = compile(toRun, process.argv.includes('--module') ? [ 'module' ] : [], {}, str => {
|
89
89
|
if (shouldPrint) process.stdout.write(str);
|
90
90
|
if (str === '-4919') shouldPrint = true;
|
91
91
|
});
|
package/r.js
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
function $DONE(error) {
|
2
|
-
if (error) {
|
3
|
-
Porffor.printStatic('Test262:AsyncTestFailure:Error: unknown');
|
4
|
-
} else {
|
5
|
-
Porffor.printStatic('Test262:AsyncTestComplete');
|
6
|
-
}
|
7
|
-
}
|
8
|
-
function assert(mustBeTrue) {
|
9
|
-
if (mustBeTrue === true) {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
|
13
|
-
throw new Test262Error('assert failed');
|
14
|
-
}
|
15
|
-
|
16
|
-
assert.throws = function (expectedErrorConstructor, func) {
|
17
|
-
if (typeof func !== 'function') {
|
18
|
-
throw new Test262Error('assert.throws invoked with a non-function value');
|
19
|
-
}
|
20
|
-
|
21
|
-
try {
|
22
|
-
func();
|
23
|
-
} catch {
|
24
|
-
return;
|
25
|
-
}
|
26
|
-
|
27
|
-
throw new Test262Error('assert.throws failed');
|
28
|
-
};
|
29
|
-
|
30
|
-
assert._isSameValue = function (a, b) {
|
31
|
-
if (a === b) {
|
32
|
-
// Handle +/-0 vs. -/+0
|
33
|
-
return a !== 0 || 1 / a === 1 / b;
|
34
|
-
}
|
35
|
-
|
36
|
-
// Handle NaN vs. NaN
|
37
|
-
return a !== a && b !== b;
|
38
|
-
};
|
39
|
-
|
40
|
-
assert.sameValue = function (actual, expected) {
|
41
|
-
if (assert._isSameValue(actual, expected)) {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
|
45
|
-
throw new Test262Error('assert.sameValue failed');
|
46
|
-
};
|
47
|
-
|
48
|
-
assert.notSameValue = function (actual, unexpected) {
|
49
|
-
if (!assert._isSameValue(actual, unexpected)) {
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
|
53
|
-
throw new Test262Error('assert.notSameValue failed');
|
54
|
-
};
|
55
|
-
// define our $262 here too
|
56
|
-
var $262 = {
|
57
|
-
global: globalThis,
|
58
|
-
gc() { /* noop */ },
|
59
|
-
detachArrayBuffer(buffer) {
|
60
|
-
return Porffor.arraybuffer.detach(buffer);
|
61
|
-
},
|
62
|
-
getGlobal(name) {
|
63
|
-
return globalThis[name];
|
64
|
-
},
|
65
|
-
// todo: setGlobal
|
66
|
-
destroy() { /* noop */ },
|
67
|
-
agent: {}
|
68
|
-
};
|
69
|
-
|
70
|
-
function Test262Error() {}
|
71
|
-
|
72
|
-
Test262Error.thrower = function (message) {
|
73
|
-
throw new Test262Error(message);
|
74
|
-
};
|
75
|
-
|
76
|
-
function $DONOTEVALUATE() {
|
77
|
-
throw 'Test262: This statement should not be evaluated.';
|
78
|
-
}
|
79
|
-
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
80
|
-
// This code is governed by the BSD license found in the LICENSE file.
|
81
|
-
/*---
|
82
|
-
es6id: 25.4.5.3
|
83
|
-
description: PerformPromiseThen on a rejected promise
|
84
|
-
info: |
|
85
|
-
7. Return PerformPromiseThen(promise, onFulfilled, onRejected,
|
86
|
-
resultCapability).
|
87
|
-
|
88
|
-
25.4.5.3.1 PerformPromiseThen
|
89
|
-
|
90
|
-
[...]
|
91
|
-
9. Else if the value of promise's [[PromiseState]] internal slot is
|
92
|
-
"rejected",
|
93
|
-
a. Let reason be the value of promise's [[PromiseResult]] internal slot.
|
94
|
-
b. Perform EnqueueJob("PromiseJobs", PromiseReactionJob,
|
95
|
-
«rejectReaction, reason»).
|
96
|
-
[...]
|
97
|
-
flags: [async]
|
98
|
-
---*/
|
99
|
-
|
100
|
-
var value = {};
|
101
|
-
var p = new Promise(function(_, reject) {
|
102
|
-
reject(value);
|
103
|
-
});
|
104
|
-
|
105
|
-
p.then(function() {
|
106
|
-
$DONE('The `onFulfilled` handler should not be invoked.');
|
107
|
-
}, function(x) {
|
108
|
-
if (x !== value) {
|
109
|
-
$DONE('The `onRejected` handler should be invoked with the promise result.');
|
110
|
-
return;
|
111
|
-
}
|
112
|
-
$DONE();
|
113
|
-
});
|