@@ -48,9 +48,11 @@ namespace ts {
4848 let requestedExternalEmitHelpers: ExternalEmitHelpers;
4949 let externalHelpersModule: Symbol;
5050
51+ // tslint:disable variable-name
5152 const Symbol = objectAllocator.getSymbolConstructor();
5253 const Type = objectAllocator.getTypeConstructor();
5354 const Signature = objectAllocator.getSignatureConstructor();
55+ // tslint:enable variable-name
5456
5557 let typeCount = 0;
5658 let symbolCount = 0;
@@ -488,17 +490,6 @@ namespace ts {
488490 /** Things we lazy load from the JSX namespace */
489491 const jsxTypes = createUnderscoreEscapedMap<Type>();
490492
491- const JsxNames = {
492- JSX: "JSX" as __String,
493- IntrinsicElements: "IntrinsicElements" as __String,
494- ElementClass: "ElementClass" as __String,
495- ElementAttributesPropertyNameContainer: "ElementAttributesProperty" as __String,
496- ElementChildrenAttributeNameContainer: "ElementChildrenAttribute" as __String,
497- Element: "Element" as __String,
498- IntrinsicAttributes: "IntrinsicAttributes" as __String,
499- IntrinsicClassAttributes: "IntrinsicClassAttributes" as __String
500- };
501-
502493 const subtypeRelation = createMap<RelationComparisonResult>();
503494 const assignableRelation = createMap<RelationComparisonResult>();
504495 const comparableRelation = createMap<RelationComparisonResult>();
@@ -25103,11 +25094,13 @@ namespace ts {
2510325094 }
2510425095
2510525096 function checkGrammarObjectLiteralExpression(node: ObjectLiteralExpression, inDestructuring: boolean) {
25106- const seen = createUnderscoreEscapedMap<SymbolFlags>();
25107- const Property = 1;
25108- const GetAccessor = 2;
25109- const SetAccessor = 4;
25110- const GetOrSetAccessor = GetAccessor | SetAccessor;
25097+ const enum Flags {
25098+ Property = 1,
25099+ GetAccessor = 2,
25100+ SetAccessor = 4,
25101+ GetOrSetAccessor = GetAccessor | SetAccessor,
25102+ }
25103+ const seen = createUnderscoreEscapedMap<Flags>();
2511125104
2511225105 for (const prop of node.properties) {
2511325106 if (prop.kind === SyntaxKind.SpreadAssignment) {
@@ -25142,26 +25135,27 @@ namespace ts {
2514225135 // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
2514325136 // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
2514425137 // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
25145- let currentKind: number;
25146- if (prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
25147- // Grammar checking for computedPropertyName and shorthandPropertyAssignment
25148- checkGrammarForInvalidQuestionMark((<PropertyAssignment>prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
25149- if (name.kind === SyntaxKind.NumericLiteral) {
25150- checkGrammarNumericLiteral(<NumericLiteral>name);
25151- }
25152- currentKind = Property;
25153- }
25154- else if (prop.kind === SyntaxKind.MethodDeclaration) {
25155- currentKind = Property;
25156- }
25157- else if (prop.kind === SyntaxKind.GetAccessor) {
25158- currentKind = GetAccessor;
25159- }
25160- else if (prop.kind === SyntaxKind.SetAccessor) {
25161- currentKind = SetAccessor;
25162- }
25163- else {
25164- Debug.assertNever(prop, "Unexpected syntax kind:" + (<Node>prop).kind);
25138+ let currentKind: Flags;
25139+ switch (prop.kind) {
25140+ case SyntaxKind.PropertyAssignment:
25141+ case SyntaxKind.ShorthandPropertyAssignment:
25142+ // Grammar checking for computedPropertyName and shorthandPropertyAssignment
25143+ checkGrammarForInvalidQuestionMark((<PropertyAssignment>prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
25144+ if (name.kind === SyntaxKind.NumericLiteral) {
25145+ checkGrammarNumericLiteral(<NumericLiteral>name);
25146+ }
25147+ // falls through
25148+ case SyntaxKind.MethodDeclaration:
25149+ currentKind = Flags.Property;
25150+ break;
25151+ case SyntaxKind.GetAccessor:
25152+ currentKind = Flags.GetAccessor;
25153+ break;
25154+ case SyntaxKind.SetAccessor:
25155+ currentKind = Flags.SetAccessor;
25156+ break;
25157+ default:
25158+ Debug.assertNever(prop, "Unexpected syntax kind:" + (<Node>prop).kind);
2516525159 }
2516625160
2516725161 const effectiveName = getPropertyNameForPropertyNameNode(name);
@@ -25174,11 +25168,11 @@ namespace ts {
2517425168 seen.set(effectiveName, currentKind);
2517525169 }
2517625170 else {
25177- if (currentKind === Property && existingKind === Property) {
25171+ if (currentKind === Flags. Property && existingKind === Flags. Property) {
2517825172 grammarErrorOnNode(name, Diagnostics.Duplicate_identifier_0, getTextOfNode(name));
2517925173 }
25180- else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) {
25181- if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) {
25174+ else if ((currentKind & Flags. GetOrSetAccessor) && (existingKind & Flags. GetOrSetAccessor)) {
25175+ if (existingKind !== Flags. GetOrSetAccessor && currentKind !== existingKind) {
2518225176 seen.set(effectiveName, currentKind | existingKind);
2518325177 }
2518425178 else {
@@ -25806,4 +25800,17 @@ namespace ts {
2580625800 return false;
2580725801 }
2580825802 }
25803+
25804+ namespace JsxNames {
25805+ // tslint:disable variable-name
25806+ export const JSX = "JSX" as __String;
25807+ export const IntrinsicElements = "IntrinsicElements" as __String;
25808+ export const ElementClass = "ElementClass" as __String;
25809+ export const ElementAttributesPropertyNameContainer = "ElementAttributesProperty" as __String;
25810+ export const ElementChildrenAttributeNameContainer = "ElementChildrenAttribute" as __String;
25811+ export const Element = "Element" as __String;
25812+ export const IntrinsicAttributes = "IntrinsicAttributes" as __String;
25813+ export const IntrinsicClassAttributes = "IntrinsicClassAttributes" as __String;
25814+ // tslint:enable variable-name
25815+ }
2580925816}
0 commit comments