porffor 0.60.13 → 0.60.15

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.
@@ -2197,20 +2197,22 @@ const createThisArg = (scope, decl) => {
2197
2197
  if (name && name.startsWith('__')) {
2198
2198
  let node = null;
2199
2199
 
2200
- if (name.includes('_prototype_')) {
2200
+ // hack: default this value for primitives, do here instead of inside funcs via ToObject/etc
2201
+ // todo: Object should not be included
2202
+ const obj = name.slice(2, name.indexOf('_', 2));
2203
+ if (name.includes('_prototype_') && ['Object', 'String', 'Boolean', 'Number'].includes(obj)) {
2201
2204
  node = {
2202
2205
  type: 'NewExpression',
2203
2206
  callee: {
2204
2207
  type: 'Identifier',
2205
- name: name.slice(2, name.indexOf('_', 2))
2208
+ name: obj
2206
2209
  },
2207
- arguments: [],
2208
- _new: true
2210
+ arguments: []
2209
2211
  };
2210
2212
  } else {
2211
2213
  node = {
2212
2214
  type: 'Identifier',
2213
- name: name.slice(2, name.lastIndexOf('_'))
2215
+ name: obj
2214
2216
  };
2215
2217
 
2216
2218
  if (ifIdentifierErrors(scope, node)) node = null;
package/foo.js CHANGED
@@ -1 +1,26 @@
1
- console.log([...'abc azc anc'.matchAll(/a[a-z]c/g)]);
1
+ const foo = {
2
+ get x() {
3
+ console.log('get x');
4
+ return 42;
5
+ }
6
+ };
7
+
8
+ const bar = { ...foo };
9
+ console.log(bar);
10
+
11
+ // const foo = {};
12
+ // Object.defineProperty(foo, 'wow', {
13
+ // value: 2,
14
+ // writable: false,
15
+ // enumerable: true,
16
+ // configurable: true,
17
+ // });
18
+
19
+ // const bar = {
20
+ // set wow(v) {
21
+ // console.log('set wow', v);
22
+ // },
23
+ // ...foo,
24
+ // };
25
+
26
+ // console.log(bar);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "An ahead-of-time JavaScript compiler",
4
- "version": "0.60.13",
4
+ "version": "0.60.15",
5
5
  "author": "Oliver Medhurst <honk@goose.icu>",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runtime/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.60.13';
3
+ globalThis.version = '0.60.15';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {