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.
@@ -6,7 +6,7 @@ export const __Porffor_object_underlying = (obj: any): any => {
6
6
 
7
7
  if (Porffor.fastAnd(
8
8
  t >= Porffor.TYPES.error,
9
- t <= Porffor.TYPES.todoerror
9
+ t < 0x40
10
10
  )) {
11
11
  return obj as object;
12
12
  }
@@ -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
- const out: ${name} = obj;
18
- return out;
16
+ return obj as ${type ? name : 'Error'};
19
17
  };
20
18
 
21
- export const __${name}_prototype_toString = (_this: ${name}) => {
22
- const obj: object = _this;
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 obj.name;
23
+ return name;
27
24
  }
28
25
 
29
- return obj.name + ': ' + message;
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 => {