diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c81e5dcc345..61f568301b2 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1765,7 +1765,7 @@ namespace ts { return bindPropertyOrMethodOrAccessor(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes); case SyntaxKind.JsxSpreadAttribute: - emitFlags |= NodeFlags.HasJsxSpreadAttribute; + emitFlags |= NodeFlags.HasJsxSpreadAttributes; return; case SyntaxKind.CallSignature: diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index a3b76996844..9f1f5b3cdbf 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2127,7 +2127,7 @@ const _super = (function (geti, seti) { helpersEmitted = true; } - if (compilerOptions.jsx !== JsxEmit.Preserve && !assignEmitted && (node.flags & NodeFlags.HasJsxSpreadAttribute)) { + if (compilerOptions.jsx !== JsxEmit.Preserve && !assignEmitted && (node.flags & NodeFlags.HasJsxSpreadAttributes)) { writeLines(assignHelper); assignEmitted = true; } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index d5f4699248d..b0873c29d3a 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1065,13 +1065,13 @@ namespace ts { // Helpers - export function createHelperName(tslib: Identifier, name: string) { + export function createHelperName(tslib: Identifier | undefined, name: string) { return tslib ? createPropertyAccess(tslib, name) : createIdentifier(name); } - export function createExtendsHelper(tslib: Identifier, name: Identifier) { + export function createExtendsHelper(tslib: Identifier | undefined, name: Identifier) { return createCall( createHelperName(tslib, "__extends"), /*typeArguments*/ undefined, @@ -1082,7 +1082,7 @@ namespace ts { ); } - export function createAssignHelper(tslib: Identifier, attributesSegments: Expression[]) { + export function createAssignHelper(tslib: Identifier | undefined, attributesSegments: Expression[]) { return createCall( createHelperName(tslib, "__assign"), /*typeArguments*/ undefined, @@ -1090,7 +1090,7 @@ namespace ts { ); } - export function createParamHelper(tslib: Identifier, expression: Expression, parameterOffset: number, location?: TextRange) { + export function createParamHelper(tslib: Identifier | undefined, expression: Expression, parameterOffset: number, location?: TextRange) { return createCall( createHelperName(tslib, "__param"), /*typeArguments*/ undefined, @@ -1102,7 +1102,7 @@ namespace ts { ); } - export function createMetadataHelper(tslib: Identifier, metadataKey: string, metadataValue: Expression) { + export function createMetadataHelper(tslib: Identifier | undefined, metadataKey: string, metadataValue: Expression) { return createCall( createHelperName(tslib, "__metadata"), /*typeArguments*/ undefined, @@ -1113,7 +1113,7 @@ namespace ts { ); } - export function createDecorateHelper(tslib: Identifier, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange) { + export function createDecorateHelper(tslib: Identifier | undefined, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange) { const argumentsArray: Expression[] = []; argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); argumentsArray.push(target); @@ -1127,7 +1127,7 @@ namespace ts { return createCall(createHelperName(tslib, "__decorate"), /*typeArguments*/ undefined, argumentsArray, location); } - export function createAwaiterHelper(tslib: Identifier, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block) { + export function createAwaiterHelper(tslib: Identifier | undefined, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block) { return createCall( createHelperName(tslib, "__awaiter"), /*typeArguments*/ undefined, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 070110e2a8d..4e191ae0170 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -388,34 +388,34 @@ namespace ts { export const enum NodeFlags { None = 0, - Let = 1 << 0, // Variable declaration - Const = 1 << 1, // Variable declaration - NestedNamespace = 1 << 2, // Namespace declaration - Synthesized = 1 << 3, // Node was synthesized during transformation - Namespace = 1 << 12, // Namespace declaration - ExportContext = 1 << 13, // Export context (initialized by binding) - ContainsThis = 1 << 14, // Interface contains references to "this" - HasImplicitReturn = 1 << 15, // If function implicitly returns on one of codepaths (initialized by binding) - HasExplicitReturn = 1 << 16, // If function has explicit reachable return on one of codepaths (initialized by binding) - GlobalAugmentation = 1 << 17, // Set if module declaration is an augmentation for the global scope - HasClassExtends = 1 << 18, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding) - HasDecorators = 1 << 19, // If the file has decorators (initialized by binding) - HasParamDecorators = 1 << 20, // If the file has parameter decorators (initialized by binding) - HasAsyncFunctions = 1 << 21, // If the file has async functions (initialized by binding) - DisallowInContext = 1 << 22, // If node was parsed in a context where 'in-expressions' are not allowed - YieldContext = 1 << 23, // If node was parsed in the 'yield' context created when parsing a generator - DecoratorContext = 1 << 24, // If node was parsed as part of a decorator - AwaitContext = 1 << 25, // If node was parsed in the 'await' context created when parsing an async function - ThisNodeHasError = 1 << 26, // If the parser encountered an error when parsing the code that created this node - JavaScriptFile = 1 << 27, // If node was parsed in a JavaScript - ThisNodeOrAnySubNodesHasError = 1 << 28, // If this node or any of its children had an error - HasAggregatedChildData = 1 << 29, // If we've computed data from children and cached it in this node - HasJsxSpreadAttribute = 1 << 30, + Let = 1 << 0, // Variable declaration + Const = 1 << 1, // Variable declaration + NestedNamespace = 1 << 2, // Namespace declaration + Synthesized = 1 << 3, // Node was synthesized during transformation + Namespace = 1 << 4, // Namespace declaration + ExportContext = 1 << 5, // Export context (initialized by binding) + ContainsThis = 1 << 6, // Interface contains references to "this" + HasImplicitReturn = 1 << 7, // If function implicitly returns on one of codepaths (initialized by binding) + HasExplicitReturn = 1 << 8, // If function has explicit reachable return on one of codepaths (initialized by binding) + GlobalAugmentation = 1 << 9, // Set if module declaration is an augmentation for the global scope + HasClassExtends = 1 << 10, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding) + HasDecorators = 1 << 11, // If the file has decorators (initialized by binding) + HasParamDecorators = 1 << 12, // If the file has parameter decorators (initialized by binding) + HasAsyncFunctions = 1 << 13, // If the file has async functions (initialized by binding) + HasJsxSpreadAttributes = 1 << 14, // If the file as JSX spread attributes (initialized by binding) + DisallowInContext = 1 << 15, // If node was parsed in a context where 'in-expressions' are not allowed + YieldContext = 1 << 16, // If node was parsed in the 'yield' context created when parsing a generator + DecoratorContext = 1 << 17, // If node was parsed as part of a decorator + AwaitContext = 1 << 18, // If node was parsed in the 'await' context created when parsing an async function + ThisNodeHasError = 1 << 19, // If the parser encountered an error when parsing the code that created this node + JavaScriptFile = 1 << 20, // If node was parsed in a JavaScript + ThisNodeOrAnySubNodesHasError = 1 << 21, // If this node or any of its children had an error + HasAggregatedChildData = 1 << 22, // If we've computed data from children and cached it in this node BlockScoped = Let | Const, ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn, - EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasJsxSpreadAttribute, + EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasJsxSpreadAttributes, ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags, // Parsing context flags