diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index be73a19802c..65d0f579f44 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -28554,7 +28554,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // circularities. Instead, we simply check if any signature has a deferred callback marker in the // particular argument position. signatures ??= getSignaturesOfType(getTypeOfExpression(flow.node.expression), SignatureKind.Call); - if (!some(signatures, sig => !!(getModifiersAtPosition(sig, i) & (ModifierFlags.Deferred | ModifierFlags.JSDocDeferred)))) { + if (some(signatures, sig => !!(getModifiersAtPosition(sig, i) & (ModifierFlags.Immediate | ModifierFlags.JSDocImmediate)))) { const lambdaType = getTypeFromFlowType(getTypeAtFlowNode(lambda.returnFlowNode)); if (lambdaType !== initialType) { lambdaTypes ??= [initialType]; @@ -41140,10 +41140,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) { error(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type); } - if (hasEffectiveModifier(node, ModifierFlags.Deferred | ModifierFlags.JSDocDeferred)) { + if (hasEffectiveModifier(node, ModifierFlags.Immediate | ModifierFlags.JSDocImmediate)) { const funcType = node.dotDotDotToken ? createArrayType(globalFunctionType, /*readonly*/ true) : globalFunctionType; if (!areTypesComparable(getTypeOfSymbol(node.symbol), funcType)) { - error(node, Diagnostics.A_deferred_parameter_must_have_a_type_that_permits_functions); + error(node, Diagnostics.An_immediate_parameter_must_have_a_type_that_permits_functions); } } } @@ -51025,26 +51025,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { break; } - case SyntaxKind.DeferredKeyword: + case SyntaxKind.ImmediateKeyword: if (node.kind !== SyntaxKind.Parameter) { - return grammarErrorOnNode(modifier, Diagnostics.deferred_modifier_can_only_appear_on_a_parameter_declaration); + return grammarErrorOnNode(modifier, Diagnostics.immediate_modifier_can_only_appear_on_a_parameter_declaration); } - if (flags & ModifierFlags.Deferred) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "deferred"); + if (flags & ModifierFlags.Immediate) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "immediate"); } if (flags & ModifierFlags.Public) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "deferred", "public"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "immediate", "public"); } if (flags & ModifierFlags.Protected) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "deferred", "protected"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "immediate", "protected"); } if (flags & ModifierFlags.Private) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "deferred", "private"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "immediate", "private"); } if (flags & ModifierFlags.Readonly) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "deferred", "readonly"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "immediate", "readonly"); } - flags |= ModifierFlags.Deferred; + flags |= ModifierFlags.Immediate; break; } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 568aeb56a12..1da5558b188 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -971,7 +971,7 @@ "category": "Error", "code": 1293 }, - "'deferred' modifier can only appear on a parameter declaration.": { + "'immediate' modifier can only appear on a parameter declaration.": { "category": "Error", "code": 1294 }, @@ -3944,7 +3944,7 @@ "category": "Error", "code": 2873 }, - "A 'deferred' parameter must have a type that permits functions.": { + "An 'immediate' parameter must have a type that permits functions.": { "category": "Error", "code": 2874 }, diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 088d2cbf27a..883036dc1e3 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -222,10 +222,10 @@ import { JSDocCallbackTag, JSDocClassTag, JSDocComment, - JSDocDeferredTag, JSDocDeprecatedTag, JSDocEnumTag, JSDocFunctionType, + JSDocImmediateTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, @@ -939,11 +939,11 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocDeprecatedTag); }, - get createJSDocDeferredTag() { - return getJSDocSimpleTagCreateFunction(SyntaxKind.JSDocDeferredTag); + get createJSDocImmediateTag() { + return getJSDocSimpleTagCreateFunction(SyntaxKind.JSDocImmediateTag); }, - get updateJSDocDeferredTag() { - return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocDeferredTag); + get updateJSDocImmediateTag() { + return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocImmediateTag); }, get createJSDocThrowsTag() { return getJSDocTypeLikeTagCreateFunction(SyntaxKind.JSDocThrowsTag); @@ -1478,7 +1478,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode case SyntaxKind.ReadonlyKeyword: case SyntaxKind.AbstractKeyword: case SyntaxKind.DeclareKeyword: - case SyntaxKind.DeferredKeyword: + case SyntaxKind.ImmediateKeyword: case SyntaxKind.ConstKeyword: case SyntaxKind.AnyKeyword: case SyntaxKind.NumberKeyword: @@ -1563,7 +1563,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode if (flags & ModifierFlags.Ambient) result.push(createModifier(SyntaxKind.DeclareKeyword)); if (flags & ModifierFlags.Default) result.push(createModifier(SyntaxKind.DefaultKeyword)); if (flags & ModifierFlags.Const) result.push(createModifier(SyntaxKind.ConstKeyword)); - if (flags & ModifierFlags.Deferred) result.push(createModifier(SyntaxKind.DeferredKeyword)); + if (flags & ModifierFlags.Immediate) result.push(createModifier(SyntaxKind.ImmediateKeyword)); if (flags & ModifierFlags.Public) result.push(createModifier(SyntaxKind.PublicKeyword)); if (flags & ModifierFlags.Private) result.push(createModifier(SyntaxKind.PrivateKeyword)); if (flags & ModifierFlags.Protected) result.push(createModifier(SyntaxKind.ProtectedKeyword)); diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index cd8d8ede72f..654c6bbc5da 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -87,10 +87,10 @@ import { JSDocAuthorTag, JSDocCallbackTag, JSDocClassTag, - JSDocDeferredTag, JSDocDeprecatedTag, JSDocEnumTag, JSDocFunctionType, + JSDocImmediateTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, @@ -1138,8 +1138,8 @@ export function isJSDocDeprecatedTag(node: Node): node is JSDocDeprecatedTag { return node.kind === SyntaxKind.JSDocDeprecatedTag; } -export function isJSDocDeferredTag(node: Node): node is JSDocDeferredTag { - return node.kind === SyntaxKind.JSDocDeferredTag; +export function isJSDocImmediateTag(node: Node): node is JSDocImmediateTag { + return node.kind === SyntaxKind.JSDocImmediateTag; } export function isJSDocSeeTag(node: Node): node is JSDocSeeTag { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 32d49f158eb..d9fa26d3b45 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -9081,8 +9081,8 @@ namespace Parser { hasDeprecatedTag = true; tag = parseSimpleTag(start, factory.createJSDocDeprecatedTag, tagName, margin, indentText); break; - case "deferred": - tag = parseSimpleTag(start, factory.createJSDocDeferredTag, tagName, margin, indentText); + case "immediate": + tag = parseSimpleTag(start, factory.createJSDocImmediateTag, tagName, margin, indentText); break; case "this": tag = parseThisTag(start, tagName, margin, indentText); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e17eb299e2e..878f88e481d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3342,7 +3342,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg case SyntaxKind.ProtectedKeyword: case SyntaxKind.ReadonlyKeyword: case SyntaxKind.DeclareKeyword: - case SyntaxKind.DeferredKeyword: + case SyntaxKind.ImmediateKeyword: case SyntaxKind.AbstractKeyword: case SyntaxKind.OverrideKeyword: case SyntaxKind.InKeyword: diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index a841fca4178..1800e8dcb9b 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -150,7 +150,6 @@ export const textToKeywordObj: MapLike = { debugger: SyntaxKind.DebuggerKeyword, declare: SyntaxKind.DeclareKeyword, default: SyntaxKind.DefaultKeyword, - deferred: SyntaxKind.DeferredKeyword, delete: SyntaxKind.DeleteKeyword, do: SyntaxKind.DoKeyword, else: SyntaxKind.ElseKeyword, @@ -164,6 +163,7 @@ export const textToKeywordObj: MapLike = { function: SyntaxKind.FunctionKeyword, get: SyntaxKind.GetKeyword, if: SyntaxKind.IfKeyword, + immediate: SyntaxKind.ImmediateKeyword, implements: SyntaxKind.ImplementsKeyword, import: SyntaxKind.ImportKeyword, in: SyntaxKind.InKeyword, @@ -352,7 +352,7 @@ const commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore) */ const commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/; -const jsDocSeeOrLinkOrDeferred = /@(?:see|link|deferred)/i; +const jsDocSeeOrLinkOrImmediate = /@(?:see|link|immediate)/i; function lookupInUnicodeMap(code: number, map: readonly number[]): boolean { // Bail out quickly if it couldn't possibly be in the map. @@ -2397,7 +2397,7 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean return false; } - return jsDocSeeOrLinkOrDeferred.test(text.slice(fullStartPos, pos)); + return jsDocSeeOrLinkOrImmediate.test(text.slice(fullStartPos, pos)); } function reScanInvalidIdentifier(): SyntaxKind { diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 145e4fd3d0f..5ab6ea370c0 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -661,7 +661,7 @@ export function transformTypeScript(context: TransformationContext) { case SyntaxKind.OverrideKeyword: case SyntaxKind.ConstKeyword: case SyntaxKind.DeclareKeyword: - case SyntaxKind.DeferredKeyword: + case SyntaxKind.ImmediateKeyword: case SyntaxKind.ReadonlyKeyword: case SyntaxKind.InKeyword: case SyntaxKind.OutKeyword: diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bd0cde013e2..f710a4af1cf 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -195,8 +195,8 @@ export const enum SyntaxKind { BooleanKeyword, ConstructorKeyword, DeclareKeyword, - DeferredKeyword, GetKeyword, + ImmediateKeyword, InferKeyword, IntrinsicKeyword, IsKeyword, @@ -420,7 +420,7 @@ export const enum SyntaxKind { JSDocImplementsTag, JSDocAuthorTag, JSDocDeprecatedTag, - JSDocDeferredTag, + JSDocImmediateTag, JSDocClassTag, JSDocPublicTag, JSDocPrivateTag, @@ -599,7 +599,6 @@ export type KeywordSyntaxKind = | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword - | SyntaxKind.DeferredKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword @@ -614,6 +613,7 @@ export type KeywordSyntaxKind = | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword + | SyntaxKind.ImmediateKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword @@ -671,8 +671,8 @@ export type ModifierSyntaxKind = | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword - | SyntaxKind.DeferredKeyword | SyntaxKind.ExportKeyword + | SyntaxKind.ImmediateKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword @@ -869,11 +869,11 @@ export const enum ModifierFlags { In = 1 << 13, // Contravariance modifier Out = 1 << 14, // Covariance modifier Decorator = 1 << 15, // Contains a decorator. - Deferred = 1 << 16, // Parameter + Immediate = 1 << 16, // Parameter // JSDoc-only modifiers Deprecated = 1 << 17, // Deprecated tag. - JSDocDeferred = 1 << 18, // Parameter + JSDocImmediate = 1 << 18, // Parameter // Cache-only JSDoc-modifiers. Should match order of Syntactic/JSDoc modifiers, above. /** @internal */ JSDocPublic = 1 << 23, // if this value changes, `selectEffectiveModifierFlags` must change accordingly @@ -883,10 +883,10 @@ export const enum ModifierFlags { /** @internal */ JSDocOverride = 1 << 27, /** @internal */ SyntacticOrJSDocModifiers = Public | Private | Protected | Readonly | Override, - /** @internal */ SyntacticOnlyModifiers = Export | Ambient | Abstract | Static | Accessor | Async | Default | Const | In | Out | Decorator | Deferred, + /** @internal */ SyntacticOnlyModifiers = Export | Ambient | Abstract | Static | Accessor | Async | Default | Const | In | Out | Decorator | Immediate, /** @internal */ SyntacticModifiers = SyntacticOrJSDocModifiers | SyntacticOnlyModifiers, /** @internal */ JSDocCacheOnlyModifiers = JSDocPublic | JSDocPrivate | JSDocProtected | JSDocReadonly | JSDocOverride, - /** @internal */ JSDocOnlyModifiers = Deprecated | JSDocDeferred, + /** @internal */ JSDocOnlyModifiers = Deprecated | JSDocImmediate, /** @internal */ NonCacheOnlyModifiers = SyntacticOrJSDocModifiers | SyntacticOnlyModifiers | JSDocOnlyModifiers, HasComputedJSDocModifiers = 1 << 28, // Indicates the computed modifier flags include modifiers from JSDoc. @@ -897,9 +897,9 @@ export const enum ModifierFlags { ParameterPropertyModifier = AccessibilityModifier | Readonly | Override, NonPublicAccessibilityModifier = Private | Protected, - TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override | In | Out | Deferred, + TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override | In | Out | Immediate, ExportDefault = Export | Default, - All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Accessor | Async | Default | Const | Deprecated | Override | In | Out | Deferred | Decorator, + All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Accessor | Async | Default | Const | Deprecated | Override | In | Out | Immediate | Decorator, Modifier = All & ~Decorator, } @@ -1636,8 +1636,8 @@ export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; export type DefaultKeyword = ModifierToken; -export type DeferredKeyword = ModifierToken; export type ExportKeyword = ModifierToken; +export type ImmediateKeyword = ModifierToken; export type InKeyword = ModifierToken; export type PrivateKeyword = ModifierToken; export type ProtectedKeyword = ModifierToken; @@ -1654,8 +1654,8 @@ export type Modifier = | ConstKeyword | DeclareKeyword | DefaultKeyword - | DeferredKeyword | ExportKeyword + | ImmediateKeyword | InKeyword | PrivateKeyword | ProtectedKeyword @@ -3994,8 +3994,8 @@ export interface JSDocDeprecatedTag extends JSDocTag { kind: SyntaxKind.JSDocDeprecatedTag; } -export interface JSDocDeferredTag extends JSDocTag { - kind: SyntaxKind.JSDocDeferredTag; +export interface JSDocImmediateTag extends JSDocTag { + kind: SyntaxKind.JSDocImmediateTag; } export interface JSDocClassTag extends JSDocTag { @@ -9057,8 +9057,8 @@ export interface NodeFactory { updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocDeprecatedTag; updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier | undefined, comment?: string | NodeArray): JSDocDeprecatedTag; - createJSDocDeferredTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocDeferredTag; - updateJSDocDeferredTag(node: JSDocDeferredTag, tagName: Identifier | undefined, comment?: string | NodeArray): JSDocDeferredTag; + createJSDocImmediateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocImmediateTag; + updateJSDocImmediateTag(node: JSDocImmediateTag, tagName: Identifier | undefined, comment?: string | NodeArray): JSDocImmediateTag; createJSDocOverrideTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocOverrideTag; updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier | undefined, comment?: string | NodeArray): JSDocOverrideTag; createJSDocThrowsTag(tagName: Identifier, typeExpression: JSDocTypeExpression | undefined, comment?: string | NodeArray): JSDocThrowsTag; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7e9f1cee6c1..7f3676f6e59 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -169,8 +169,8 @@ import { getDirectoryPath, getImpliedNodeFormatForEmitWorker, getJSDocAugmentsTag, - getJSDocDeferredTagNoCache, getJSDocDeprecatedTagNoCache, + getJSDocImmediateTagNoCache, getJSDocImplementsTags, getJSDocOverrideTagNoCache, getJSDocParameterTags, @@ -7108,7 +7108,7 @@ function getRawJSDocModifierFlagsNoCache(node: Node): ModifierFlags { } } if (!isParameter(node) && getJSDocDeprecatedTagNoCache(node)) flags |= ModifierFlags.Deprecated; - if (getJSDocDeferredTagNoCache(node)) flags |= ModifierFlags.JSDocDeferred; + if (getJSDocImmediateTagNoCache(node)) flags |= ModifierFlags.JSDocImmediate; } return flags; @@ -7198,8 +7198,8 @@ export function modifierToFlag(token: SyntaxKind): ModifierFlags { return ModifierFlags.In; case SyntaxKind.OutKeyword: return ModifierFlags.Out; - case SyntaxKind.DeferredKeyword: - return ModifierFlags.Deferred; + case SyntaxKind.ImmediateKeyword: + return ModifierFlags.Immediate; case SyntaxKind.Decorator: return ModifierFlags.Decorator; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 8b0e397e7c5..c441d03d641 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -137,10 +137,10 @@ import { isJSDoc, isJSDocAugmentsTag, isJSDocClassTag, - isJSDocDeferredTag, isJSDocDeprecatedTag, isJSDocEnumTag, isJSDocFunctionType, + isJSDocImmediateTag, isJSDocImplementsTag, isJSDocOverloadTag, isJSDocOverrideTag, @@ -182,9 +182,9 @@ import { JSDocClassTag, JSDocComment, JSDocContainer, - JSDocDeferredTag, JSDocDeprecatedTag, JSDocEnumTag, + JSDocImmediateTag, JSDocImplementsTag, JSDocLink, JSDocLinkCode, @@ -1163,14 +1163,14 @@ export function getJSDocDeprecatedTagNoCache(node: Node): JSDocDeprecatedTag | u return getFirstJSDocTag(node, isJSDocDeprecatedTag, /*noCache*/ true); } -/** Gets the JSDoc deferred tag for the node if present */ -export function getJSDocDeferredTag(node: Node): JSDocDeferredTag | undefined { - return getFirstJSDocTag(node, isJSDocDeferredTag); +/** Gets the JSDoc immediate tag for the node if present */ +export function getJSDocImmediateTag(node: Node): JSDocImmediateTag | undefined { + return getFirstJSDocTag(node, isJSDocImmediateTag); } /** @internal */ -export function getJSDocDeferredTagNoCache(node: Node): JSDocDeferredTag | undefined { - return getFirstJSDocTag(node, isJSDocDeferredTag, /*noCache*/ true); +export function getJSDocImmediateTagNoCache(node: Node): JSDocImmediateTag | undefined { + return getFirstJSDocTag(node, isJSDocImmediateTag, /*noCache*/ true); } /** Gets the JSDoc enum tag for the node if present */ @@ -1609,8 +1609,8 @@ export function isModifierKind(token: SyntaxKind): token is Modifier["kind"] { case SyntaxKind.ConstKeyword: case SyntaxKind.DeclareKeyword: case SyntaxKind.DefaultKeyword: - case SyntaxKind.DeferredKeyword: case SyntaxKind.ExportKeyword: + case SyntaxKind.ImmediateKeyword: case SyntaxKind.InKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: