Remove DestructuringAssignment and Generator flags

This commit is contained in:
Ron Buckton
2019-03-06 15:04:13 -08:00
parent cc9e2f4e57
commit 1f212ec265
5 changed files with 19 additions and 36 deletions
+1 -16
View File
@@ -3189,7 +3189,6 @@ namespace ts {
let transformFlags = subtreeFlags;
const expression = node.expression;
const expressionKind = expression.kind;
const expressionTransformFlags = expression.transformFlags;
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
@@ -3199,12 +3198,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertTypeScript;
}
// If the expression of a ParenthesizedExpression is a destructuring assignment,
// then the ParenthesizedExpression is a destructuring assignment.
if (expressionTransformFlags & TransformFlags.DestructuringAssignment) {
transformFlags |= TransformFlags.DestructuringAssignment;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.OuterExpressionExcludes;
}
@@ -3585,15 +3578,7 @@ namespace ts {
}
function computeExpressionStatement(node: ExpressionStatement, subtreeFlags: TransformFlags) {
let transformFlags = subtreeFlags;
// If the expression of an expression statement is a destructuring assignment,
// then we treat the statement as ES6 so that we can indicate that we do not
// need to hold on to the right-hand side.
if (node.expression.transformFlags & TransformFlags.DestructuringAssignment) {
transformFlags |= TransformFlags.AssertES2015;
}
const transformFlags = subtreeFlags;
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.NodeExcludes;
}
+1 -1
View File
@@ -316,7 +316,7 @@ namespace ts {
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
else if (transformFlags & TransformFlags.Generator) {
else if (isFunctionLikeDeclaration(node) && node.asteriskToken) {
return visitGenerator(node);
}
else if (transformFlags & TransformFlags.ContainsGenerator) {
+2 -2
View File
@@ -537,8 +537,8 @@ namespace ts {
if (isImportCall(node)) {
return visitImportCallExpression(node);
}
else if (node.transformFlags & TransformFlags.DestructuringAssignment && isBinaryExpression(node)) {
return visitDestructuringAssignment(node as DestructuringAssignment);
else if (isDestructuringAssignment(node)) {
return visitDestructuringAssignment(node);
}
else {
return visitEachChild(node, moduleExpressionElementVisitor, context);
+2 -3
View File
@@ -1463,9 +1463,8 @@ namespace ts {
* @param node The node to visit.
*/
function destructuringAndImportCallVisitor(node: Node): VisitResult<Node> {
if (node.transformFlags & TransformFlags.DestructuringAssignment
&& node.kind === SyntaxKind.BinaryExpression) {
return visitDestructuringAssignment(<DestructuringAssignment>node);
if (isDestructuringAssignment(node)) {
return visitDestructuringAssignment(node);
}
else if (isImportCall(node)) {
return visitImportCallExpression(node);
+13 -14
View File
@@ -5049,21 +5049,20 @@ namespace ts {
ContainsES2016 = 1 << 5,
ContainsES2015 = 1 << 6,
ContainsGenerator = 1 << 7,
DestructuringAssignment = 1 << 8,
ContainsDestructuringAssignment = 1 << 9,
ContainsDestructuringAssignment = 1 << 8,
// Markers
// - Flags used to indicate that a subtree contains a specific transformation.
ContainsTypeScriptClassSyntax = 1 << 10, // Decorators, Property Initializers, Parameter Property Initializers
ContainsLexicalThis = 1 << 11,
ContainsRestOrSpread = 1 << 12,
ContainsObjectRestOrSpread = 1 << 13,
ContainsComputedPropertyName = 1 << 14,
ContainsBlockScopedBinding = 1 << 15,
ContainsBindingPattern = 1 << 16,
ContainsYield = 1 << 17,
ContainsHoistedDeclarationOrCompletion = 1 << 18,
ContainsDynamicImport = 1 << 19,
ContainsTypeScriptClassSyntax = 1 << 9, // Decorators, Property Initializers, Parameter Property Initializers
ContainsLexicalThis = 1 << 10,
ContainsRestOrSpread = 1 << 11,
ContainsObjectRestOrSpread = 1 << 12,
ContainsComputedPropertyName = 1 << 13,
ContainsBlockScopedBinding = 1 << 14,
ContainsBindingPattern = 1 << 15,
ContainsYield = 1 << 16,
ContainsHoistedDeclarationOrCompletion = 1 << 17,
ContainsDynamicImport = 1 << 18,
// Please leave this as 1 << 29.
// It is the maximum bit we can set before we outgrow the size of a v8 small integer (SMI) on an x86 system.
@@ -5080,12 +5079,12 @@ namespace ts {
AssertES2016 = ContainsES2016,
AssertES2015 = ContainsES2015,
AssertGenerator = ContainsGenerator,
AssertDestructuringAssignment = DestructuringAssignment | ContainsDestructuringAssignment,
AssertDestructuringAssignment = ContainsDestructuringAssignment,
// Scope Exclusions
// - Bitmasks that exclude flags from propagating out of a specific context
// into the subtree flags of their container.
OuterExpressionExcludes = DestructuringAssignment | HasComputedFlags,
OuterExpressionExcludes = HasComputedFlags,
PropertyAccessExcludes = OuterExpressionExcludes,
NodeExcludes = PropertyAccessExcludes,
ArrowFunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,