Skip to content

Commit a21024d

Browse files
authored
Delete unused code in object literal binding (#49879)
It doesn't do anything anymore. I'm not sure what it used to do; it's been there basically forever.
1 parent bb913f8 commit a21024d

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

src/compiler/binder.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,41 +2040,6 @@ namespace ts {
20402040
}
20412041

20422042
function bindObjectLiteralExpression(node: ObjectLiteralExpression) {
2043-
const enum ElementKind {
2044-
Property = 1,
2045-
Accessor = 2
2046-
}
2047-
2048-
if (inStrictMode && !isAssignmentTarget(node)) {
2049-
const seen = new Map<__String, ElementKind>();
2050-
2051-
for (const prop of node.properties) {
2052-
if (prop.kind === SyntaxKind.SpreadAssignment || prop.name.kind !== SyntaxKind.Identifier) {
2053-
continue;
2054-
}
2055-
2056-
const identifier = prop.name;
2057-
2058-
// ECMA-262 11.1.5 Object Initializer
2059-
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
2060-
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
2061-
// IsDataDescriptor(propId.descriptor) is true.
2062-
// b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
2063-
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
2064-
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
2065-
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
2066-
const currentKind = prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment || prop.kind === SyntaxKind.MethodDeclaration
2067-
? ElementKind.Property
2068-
: ElementKind.Accessor;
2069-
2070-
const existingKind = seen.get(identifier.escapedText);
2071-
if (!existingKind) {
2072-
seen.set(identifier.escapedText, currentKind);
2073-
continue;
2074-
}
2075-
}
2076-
}
2077-
20782043
return bindAnonymousDeclaration(node, SymbolFlags.ObjectLiteral, InternalSymbolName.Object);
20792044
}
20802045

0 commit comments

Comments
 (0)