Removed unused text-concatenating emit.

This commit is contained in:
Daniel Rosenwasser
2015-02-20 14:17:26 -08:00
parent 51129a704d
commit 78425d6e0f

View File

@@ -2711,126 +2711,6 @@ module ts {
return result;
}
function emitDownlevelObjectLiteralWithComputedProperties2(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) {
var multiLine = (node.flags & NodeFlags.MultiLine) !== 0;
var properties = node.properties;
write("(");
if (multiLine) {
increaseIndent();
}
// For computed properties, we need to create a unique handle to the object
// literal so we can modify it without risking internal assignments tainting the object.
var tempVar = createAndRecordTempVariable(node);
// Write out the first non-computed properties
// (or all properties if none of them are computed),
// then emit the rest through indexing on the temp variable.
emit(tempVar)
write(" = ");
emitObjectLiteralBody(node, firstComputedPropertyIndex);
for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) {
writeComma();
var property = properties[i];
emitStart(property)
if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) {
// TODO (drosen): Reconcile with 'emitMemberFunctions'.
var accessors = getAllAccessorDeclarations(node.properties, <AccessorDeclaration>property);
if (property !== accessors.firstAccessor) {
continue;
}
write("Object.defineProperty(");
emit(tempVar);
write(", ");
emitStart(node.name);
emitExpressionForPropertyName(property.name);
emitEnd(property.name);
write(", {");
increaseIndent();
if (accessors.getAccessor) {
writeLine()
emitLeadingComments(accessors.getAccessor);
write("get: ");
emitStart(accessors.getAccessor);
write("function ");
emitSignatureAndBody(accessors.getAccessor);
emitEnd(accessors.getAccessor);
emitTrailingComments(accessors.getAccessor);
write(",");
}
if (accessors.setAccessor) {
writeLine();
emitLeadingComments(accessors.setAccessor);
write("set: ");
emitStart(accessors.setAccessor);
write("function ");
emitSignatureAndBody(accessors.setAccessor);
emitEnd(accessors.setAccessor);
emitTrailingComments(accessors.setAccessor);
write(",");
}
writeLine();
write("enumerable: true,");
writeLine();
write("configurable: true");
decreaseIndent();
writeLine();
write("})");
emitEnd(property);
}
else {
emitLeadingComments(property);
emitStart(property.name);
emit(tempVar);
emitMemberAccessForPropertyName(property.name);
emitEnd(property.name);
write(" = ");
if (property.kind === SyntaxKind.PropertyAssignment) {
emit((<PropertyAssignment>property).initializer);
}
else if (property.kind === SyntaxKind.ShorthandPropertyAssignment) {
emitExpressionIdentifier((<ShorthandPropertyAssignment>property).name);
}
else if (property.kind === SyntaxKind.MethodDeclaration) {
emitFunctionDeclaration(<MethodDeclaration>property);
}
else {
Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind);
}
}
emitEnd(property);
}
writeComma();
emit(tempVar);
if (multiLine) {
decreaseIndent();
writeLine();
}
write(")");
function writeComma() {
if (multiLine) {
write(",");
writeLine();
}
else {
write(", ");
}
}
}
function emitObjectLiteral(node: ObjectLiteralExpression): void {
var properties = node.properties;