oxc/crates/oxc_syntax/src
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
..
generated perf(syntax): reorder operator enum variants (#7351) 2024-11-19 01:23:28 +00:00
class.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
identifier.rs fix(identifier): add ZWSP to is_irregular_whitespace (#6662) 2024-10-18 22:20:02 +00:00
keyword.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
lib.rs feat(parser): Generate Serialize impls in ast_tools (#6404) 2024-10-19 09:38:44 +01:00
module_graph_visitor.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
module_record.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
node.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
number.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
operator.rs fix(semantic)!: correct all ReferenceFlags::Write according to the spec (#7388) 2024-11-22 06:08:30 +00:00
precedence.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
reference.rs docs(syntax): more comments for ReferenceFlags (#7392) 2024-11-21 11:20:28 +00:00
scope.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
symbol.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00
xml_entities.rs docs(syntax): enable lint warnings on missing docs, and add a lot of documentation (#6611) 2024-10-15 22:50:45 +00:00