From a9742c58610db0785b051f7da3c668ce5ade72a6 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 11 May 2016 09:48:37 -0700 Subject: [PATCH] Change name from ConstructorParameterModifier to ParameterPropertyModifier --- src/compiler/checker.ts | 6 +++--- src/compiler/declarationEmitter.ts | 2 +- src/compiler/emitter.ts | 2 +- src/compiler/types.ts | 2 +- src/compiler/utilities.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 296d3ead675..3350a4f08fb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12658,7 +12658,7 @@ namespace ts { checkVariableLikeDeclaration(node); let func = getContainingFunction(node); - if (node.flags & NodeFlags.ConstructorParameterModifier) { + if (node.flags & NodeFlags.ParameterPropertyModifier) { func = getContainingFunction(node); if (!(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body))) { error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -12994,7 +12994,7 @@ namespace ts { // or the containing class declares instance member variables with initializers. const superCallShouldBeFirst = forEach((node.parent).members, isInstancePropertyWithInitializer) || - forEach(node.parameters, p => p.flags & NodeFlags.ConstructorParameterModifier); + forEach(node.parameters, p => p.flags & NodeFlags.ParameterPropertyModifier); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. @@ -17760,7 +17760,7 @@ namespace ts { else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && flags & NodeFlags.Ambient) { return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.ConstructorParameterModifier) && isBindingPattern((node).name)) { + else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.ParameterPropertyModifier) && isBindingPattern((node).name)) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & NodeFlags.Async) { diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 90ac0c0719b..c24135ba52e 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -1051,7 +1051,7 @@ namespace ts { function emitParameterProperties(constructorDeclaration: ConstructorDeclaration) { if (constructorDeclaration) { forEach(constructorDeclaration.parameters, param => { - if (param.flags & NodeFlags.ConstructorParameterModifier) { + if (param.flags & NodeFlags.ParameterPropertyModifier) { emitPropertyDeclaration(param); } }); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0e14adf07b4..39fb7bff1d9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4979,7 +4979,7 @@ const _super = (function (geti, seti) { function emitParameterPropertyAssignments(node: ConstructorDeclaration) { forEach(node.parameters, param => { - if (param.flags & NodeFlags.ConstructorParameterModifier) { + if (param.flags & NodeFlags.ParameterPropertyModifier) { writeLine(); emitStart(param); emitStart(param.name); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0899b01620e..6f1df6f14fd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -410,7 +410,7 @@ namespace ts { Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async | Readonly, AccessibilityModifier = Public | Private | Protected, // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. - ConstructorParameterModifier = AccessibilityModifier | Readonly, + ParameterPropertyModifier = AccessibilityModifier | Readonly, BlockScoped = Let | Const, ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index fc5fb8aac0b..0f875cc87ca 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3021,7 +3021,7 @@ namespace ts { } export function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean { - return node.flags & NodeFlags.ConstructorParameterModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); + return node.flags & NodeFlags.ParameterPropertyModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); } export function startsWith(str: string, prefix: string): boolean {