Commit graph

11 commits

Author SHA1 Message Date
Dunqing
0ca10e270a refactor(transformer): use ctx.var_declarations.create_var* methods (#7666)
It turns out these APIs are very useful, we remove many boilerplate code.
2024-12-05 14:31:20 +00:00
Dunqing
7ff9f13973 fix(transformer): correct all ReferenceFlags (#7410) 2024-11-22 09:10:55 +00:00
Dunqing
6f0fe38bff fix(semantic)!: correct all ReferenceFlags::Write according to the spec (#7388)
close #7323

According to the specification re-design the JavaScript-part ReferenceFlags inferring approach.

* https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-postfix-increment-operator-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-runtime-semantics-restdestructuringassignmentevaluation
* ... See references of https://tc39.es/ecma262/#sec-putvalue

### Changes

1. The left-hand of `AssignmentExpression` is always `ReferenceFlags::Write`
```js
let a = 0;
console.log(a = 0);
            ^ Write only
```

2. The `argument` of `UpdateExpression` is always `ReferenceFlags::Read | Write`
```js
let a = 0;
a++;
^ Read and Write
```

This change might cause some trouble for `Minfier` to remove this code, because ‘a’ is not used elsewhere. I have taken a look at `esbuild` and `Terser`. Only the `Terser` can remove this code.
2024-11-22 06:08:30 +00:00
Boshen
885e37f8eb feat(transformer): Optional Chaining (#6990)
close: #6958
2024-11-21 03:12:18 +00:00
Boshen
0e4adc15dd feat(ast)!: remove invalid expressions from TSEnumMemberName (#7219) 2024-11-09 08:48:14 +00:00
Dunqing
ede10dc030 fix(transformer/async-to-generator): incorrect transform when super expression is inside async method (#7171)
After transformation, super expressions have moved to unexpected places. This PR replaces super expression to call expression, and then inserts the super methods to the top of the method body.

For example:

Before:
```js
class G {
  async method() {
    super.foo()
  }
}
```

After:
```js
class G {
  method() {
    var _superprop_getFoo = () => super.foo,
      _this = this;
    return _asyncToGenerator(function* () {
      _superprop_getFoo().call(_this);
    })();
  }
}```
2024-11-08 08:18:45 +00:00
Dunqing
8573f79c6d feat(transformer): turn on async_to_generator and async_generator_functions plugins in enable_all (#7135) 2024-11-06 03:27:13 +00:00
Dunqing
076f5c39f4 fix(transformer/typescript): retain ExportNamedDeclaration without specifiers and declaration (#6848)
close: #6825
2024-10-24 07:59:07 +00:00
overlookmotel
0f5afd7ede test(transformer): transform checker output symbol name for mismatches (#6286)
Transform checker include symbol names in output for symbol mismatches. This is rather more helpful for locating bugs than just `SymbolId(3)`.
2024-10-05 14:42:06 +00:00
DonIsaac
f1551d64bc fix(semantic): ? on variable declaration type annotations is a syntax error (#5956)
Closes #5955
2024-09-22 00:01:47 +00:00
overlookmotel
eadffb900e test(conformance): move conformance snapshots into separate directory (#5924) 2024-09-20 12:30:39 +00:00
Renamed from tasks/coverage/semantic_misc.snap (Browse further)