Conversation
I missed these before, so emit was incorrect for object rest in a method or accessor parameter.
sandersn
left a comment
There was a problem hiding this comment.
The code change looks good although I still need to look at the tests. Glancing over them, though, it looks like it's just improvements.
src/compiler/factory.ts
Outdated
| /*recordTempVariable*/ undefined, | ||
| /*skipInitializer*/ false, | ||
| /*recordTempVariablesInLine*/ true, | ||
| convertObjectRest |
There was a problem hiding this comment.
This is not an issue now that I've merged in the work from isolateObjectSpread.
src/compiler/factory.ts
Outdated
| temp, | ||
| /*skipInitializer*/ convertObjectRest, | ||
| /*recordTempVariablesInLine*/ true, | ||
| convertObjectRest |
There was a problem hiding this comment.
why not make the enum a parameter to this function instead of handling the boolean?
There was a problem hiding this comment.
This is not an issue now that I've merged in the work from isolateObjectSpread.
src/compiler/factory.ts
Outdated
| context.hoistVariableDeclaration, | ||
| visitor, | ||
| convertObjectRest | ||
| ? FlattenLevel.ObjectRest |
|
|
||
| /*@internal*/ | ||
| namespace ts { | ||
| interface FlattenHost { |
There was a problem hiding this comment.
probably FlattenContext is a better name
| const propertyName = getPropertyNameOfBindingOrAssignmentElement(elements[i]); | ||
| if (propertyName) { | ||
| if (isComputedPropertyName(propertyName)) { | ||
| // get the temp name and put that in there instead, like `_tmp + ""` |
There was a problem hiding this comment.
can you update this to just give the emit: typeof _tmp === "symbol" ? _tmp : _tmp + "" ? The comment I wrote is wordy and out of date to boot.
…accessor-parameters' into streamlineDestructuring
sandersn
left a comment
There was a problem hiding this comment.
Looks good except for some typos.
src/compiler/transformer.ts
Outdated
| */ | ||
| function hoistVariableDeclaration(name: Identifier): void { | ||
| Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); | ||
| Debug.assert(!scopeModificationDisabled, "Cannot modify the lexical environment during the print phase."); |
There was a problem hiding this comment.
Probably should update the assert message.
There was a problem hiding this comment.
Or maybe this is still correct. I can't tell.
| context: TransformationContext; | ||
| level: FlattenLevel; | ||
| recordTempVariablesInLine: boolean; | ||
| doNotRecordTempVariablesInLine: boolean; |
There was a problem hiding this comment.
Minor, but is there a positive way to express doNotRecordInline? Hoist? Extrapose? Prepend?
| * @param boundValue The value bound to the declaration. | ||
| * @param recordTempVariablesInLine Indicates whether temporary variables should be recored in-line. | ||
| * @param skipInitializer A value indicating whether to ignore the initializer of `node`. | ||
| * @param doNotRecordTempVariablesInLine Indicates whether temporary variables should not be recored in-line. |
| boundValue: Expression | undefined, | ||
| flattenContext: FlattenContext, | ||
| element: BindingOrAssignmentElement, | ||
| value: Expression | undefined, |
| } | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
These 3-line jsdoc are low-value in my opinion. They just restate in English what the signature already says.
This PR cleans up some of our destructuring transform to be more consistent, along with a few additional changes:
NodeArrayatransformFlagsproperty which consists of the transform flags of each node in the array without exclusions. This allows us to query the transform flags of each node in a node array without the need to traverse the array.TransformFlagsenum members to free up some spaceContainsObjectRest/ContainsObjectSpreadto allow us to more accurately detect esnext features.checkReferenceExpressionto align with the spec proposal.DestructuringAssignmentthat goes unused.esnext.tsto remove dependencies ones2015transformations.es2015transformations added tofactory.tsback intoes2015.ts