porffor 0.57.3 → 0.57.4

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.
@@ -247,17 +247,6 @@ i32.const 7 ;; object
247
247
  return`;
248
248
  }
249
249
 
250
- if (Porffor.fastAnd(
251
- Porffor.type(_obj) >= Porffor.TYPES.error,
252
- Porffor.type(_obj) < 0x40
253
- )) {
254
- Porffor.wasm`
255
- local.get ${_obj}
256
- i32.trunc_sat_f64_u
257
- i32.const 7 ;; object
258
- return`;
259
- }
260
-
261
250
  if (Porffor.fastAnd(
262
251
  Porffor.type(_obj) > 0x05,
263
252
  Porffor.type(_obj) != Porffor.TYPES.undefined
@@ -2,29 +2,49 @@ export default () => {
2
2
  let out = '';
3
3
 
4
4
  const errors = [];
5
- const error = (name, type = true) => {
6
- if (type) errors.push(name);
7
- out += `export const ${name} = function (message: any): ${type ? name : 'Error'} {
5
+ const error = name => {
6
+ errors.push(name);
7
+ out += `export const ${name} = function (message: any): ${name} {
8
8
  if (message === undefined) message = '';
9
9
  else message = ecma262.ToString(message);
10
10
 
11
- const obj: object = Porffor.allocateBytes(128);
12
- obj.name = '${name}';
13
- obj.message = message;
14
- obj.constructor = ${name};
11
+ const obj: ${name} = Porffor.allocateBytes(8);
12
+ Porffor.wasm.i32.store(obj, message, 0, 0);
13
+ Porffor.wasm.i32.store8(obj, Porffor.type(message), 0, 4);
15
14
 
16
- return obj as ${type ? name : 'Error'};
15
+ return obj;
17
16
  };
18
17
 
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;
18
+ export const __${name}_prototype_constructor$get = (_this: ${name}) => {
19
+ return ${name};
20
+ };
21
+
22
+ export const __${name}_prototype_name$get = (_this: ${name}) => {
23
+ return '${name}';
24
+ };
25
+
26
+ export const __${name}_prototype_message$get = (_this: ${name}) => {
27
+ Porffor.wasm\`
28
+ local.get \${_this}
29
+ i32.trunc_sat_f64_u
30
+ i32.load 0 0
31
+ f64.convert_i32_u
32
+
33
+ local.get \${_this}
34
+ i32.trunc_sat_f64_u
35
+ i32.load8_u 0 4
36
+ return\`;
37
+ };
38
+
39
+ export const __${name}_prototype_toString = (_this: ${name}) => {
40
+ const name: any = _this.name;
41
+ const message: any = _this.message;
22
42
  if (message.length == 0) {
23
43
  return name;
24
44
  }
25
45
 
26
46
  return name + ': ' + message;
27
- };` : ''}`;
47
+ };\n`;
28
48
  };
29
49
 
30
50
  error('Error');
@@ -36,7 +56,6 @@ ${type ? `export const __${name}_prototype_toString = (_this: ${name}) => {
36
56
  error('EvalError');
37
57
  error('URIError');
38
58
  error('Test262Error');
39
- error('TodoError', false);
40
59
 
41
60
  out += `
42
61
  export const __Test262Error_thrower = message => {