porffor 0.55.28 → 0.55.31
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/builtins/__internal_object.ts +1 -1
- package/compiler/builtins/error.js +11 -15
- package/compiler/builtins_precompiled.js +1476 -1467
- package/compiler/codegen.js +17 -5
- package/compiler/types.js +8 -10
- package/compiler/wrap.js +1 -2
- package/package.json +1 -1
- package/r.cjs +252 -3
- package/runner/index.js +1 -1
@@ -2,32 +2,29 @@ export default () => {
|
|
2
2
|
let out = '';
|
3
3
|
|
4
4
|
const errors = [];
|
5
|
-
const error = name => {
|
6
|
-
errors.push(name);
|
7
|
-
out += `export const ${name} = function (message: any) {
|
5
|
+
const error = (name, type = true) => {
|
6
|
+
if (type) errors.push(name);
|
7
|
+
out += `export const ${name} = function (message: any): ${type ? name : 'Error'} {
|
8
8
|
if (message === undefined) message = '';
|
9
9
|
else message = ecma262.ToString(message);
|
10
10
|
|
11
11
|
const obj: object = Porffor.allocateBytes(128);
|
12
|
-
|
13
12
|
obj.name = '${name}';
|
14
13
|
obj.message = message;
|
15
14
|
obj.constructor = ${name};
|
16
15
|
|
17
|
-
|
18
|
-
return out;
|
16
|
+
return obj as ${type ? name : 'Error'};
|
19
17
|
};
|
20
18
|
|
21
|
-
export const __${name}_prototype_toString = (_this: ${name}) => {
|
22
|
-
const
|
23
|
-
|
24
|
-
const message: any = obj.message;
|
19
|
+
${type ? `export const __${name}_prototype_toString = (_this: ${name}) => {
|
20
|
+
const name: any = (_this as object).name;
|
21
|
+
const message: any = (_this as object).message;
|
25
22
|
if (message.length == 0) {
|
26
|
-
return
|
23
|
+
return name;
|
27
24
|
}
|
28
25
|
|
29
|
-
return
|
30
|
-
}
|
26
|
+
return name + ': ' + message;
|
27
|
+
};` : ''}`;
|
31
28
|
};
|
32
29
|
|
33
30
|
error('Error');
|
@@ -38,9 +35,8 @@ export const __${name}_prototype_toString = (_this: ${name}) => {
|
|
38
35
|
error('RangeError');
|
39
36
|
error('EvalError');
|
40
37
|
error('URIError');
|
41
|
-
|
42
38
|
error('Test262Error');
|
43
|
-
error('TodoError');
|
39
|
+
error('TodoError', false);
|
44
40
|
|
45
41
|
out += `
|
46
42
|
export const __Test262Error_thrower = message => {
|