mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-25 18:50:29 -06:00
Change name from ConstructorParameterModifier to ParameterPropertyModifier
This commit is contained in:
parent
ad2634e343
commit
a9742c5861
@ -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((<ClassDeclaration>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((<ParameterDeclaration>node).name)) {
|
||||
else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.ParameterPropertyModifier) && isBindingPattern((<ParameterDeclaration>node).name)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_a_binding_pattern);
|
||||
}
|
||||
if (flags & NodeFlags.Async) {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user