fix(semantic)!: correct all ReferenceFlags::Write according to the spec#7388
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
ReferenceFlags from Visit methods
f3b83b8 to
edcf14b
Compare
ReferenceFlags from Visit methodsReferenceFlags inferring approach
CodSpeed Performance ReportMerging #7388 will not alter performanceComparing Summary
|
bab338b to
419b321
Compare
|
I prefer to fix transformer-related semantic errors in follow-up PR, but if you think should be fixed in this PR I am okay |
Boshen
left a comment
There was a problem hiding this comment.
Can you add the test case to no-const-assign?
const FOO = 1;
({
files = FOO,
} = arg1);
|
Can
Can you add all the assignment cases to no object assign? |
Added
I have already added a lot of assignment-related tests in semantic. |
ReferenceFlags inferring approachReferenceFlags::Write according to the spec
b3a05fa to
8c295bd
Compare
Merge activity
|
…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.
8c295bd to
c28477b
Compare
…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.
c28477b to
6f0fe38
Compare
|
@Dunqing Is |

close #7323
According to the specification re-design the JavaScript-part ReferenceFlags inferring approach.
Changes
AssignmentExpressionis alwaysReferenceFlags::WriteargumentofUpdateExpressionis alwaysReferenceFlags::Read | WriteThis change might cause some trouble for
Minfierto remove this code, because ‘a’ is not used elsewhere. I have taken a look atesbuildandTerser. Only theTersercan remove this code.