mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
43677da7e465d89ac33bc5603d6fba83c50f1bc1
Adds new instructions to accurately model UpdateExpression semantics, since `x++` is un-intuitively not the same as `x = x + 1`. There are a few different ways to model the combination of prefix/postfix and increment/decrement: * One instruction for all combinations of prefix/postfix and increment/decrement, eg 'UpdateExpression' * Instructions for Increment/Decrement, each with a property to distinguish prefix/postfix * Instructions for Prefix/Postfix, each with aproperty to distinguish increment/decrement. I chose the latter, `PrefixUpdate` and `PostfixUpdate`, because it keeps the number of new instructions minimal while keeping separate instructions for the most important distinction: whether the result of the instruction is the value before applying the operation or after. I'm open to suggestions about this though. A few quick notes: * Constant propagation is supported but only for numbers (we don't support bigint yet anyway) * LeaveSSA needs to know about these instructions since their presence requires making the original variable declaration Let, not Const. * EnterSSA mapped lvalues before rvalues, which is out of order but didn't previously matter. I just had to flip the order and everything worked.
Description
Languages
JavaScript
67.1%
TypeScript
29.4%
HTML
1.5%
CSS
1.1%
C++
0.6%
Other
0.2%