mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Address PR commennts
Update baselines with smaller emit as part of that.
This commit is contained in:
@@ -11193,9 +11193,8 @@ namespace ts {
|
||||
let hasComputedStringProperty = false;
|
||||
let hasComputedNumberProperty = false;
|
||||
|
||||
let i = 0;
|
||||
let offset = 0;
|
||||
for (i = 0; i < node.properties.length; i++) {
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
const memberDecl = node.properties[i];
|
||||
let member = memberDecl.symbol;
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment ||
|
||||
|
||||
@@ -45,7 +45,7 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
const restHelper = `
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) === -1)
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
return t;
|
||||
};`;
|
||||
|
||||
@@ -326,7 +326,7 @@ namespace ts {
|
||||
// Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node
|
||||
const propAccess = createDestructuringPropertyAccess(value, propName);
|
||||
if (isComputedPropertyName(propName)) {
|
||||
(computedTempVariables = computedTempVariables || []).push((propAccess as ElementAccessExpression).argumentExpression);
|
||||
computedTempVariables = append(computedTempVariables, (propAccess as ElementAccessExpression).argumentExpression);
|
||||
}
|
||||
emitDestructuringAssignment(bindingTarget, propAccess, p);
|
||||
}
|
||||
@@ -428,18 +428,11 @@ namespace ts {
|
||||
}
|
||||
if (isComputedPropertyName(getPropertyName(element))) {
|
||||
// get the temp name and put that in there instead, like `_tmp + ""`
|
||||
const stringifiedTemp = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
|
||||
stringifiedTemp.pos = location.pos;
|
||||
stringifiedTemp.end = location.end;
|
||||
stringifiedTemp.text = "";
|
||||
propertyNames.push(createBinary(computedTempVariables.shift(), SyntaxKind.PlusToken, stringifiedTemp));
|
||||
propertyNames.push(createBinary(computedTempVariables.shift(), SyntaxKind.PlusToken, createLiteral("")));
|
||||
}
|
||||
else {
|
||||
const str = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
|
||||
str.pos = location.pos;
|
||||
str.end = location.end;
|
||||
str.text = getTextOfPropertyName(getPropertyName(element));
|
||||
propertyNames.push(str);
|
||||
const propName = getTextOfPropertyName(getPropertyName(element));
|
||||
propertyNames.push(createLiteral(propName, location));
|
||||
}
|
||||
}
|
||||
const args = createSynthesizedNodeArray([value, createArrayLiteral(propertyNames, location)]);
|
||||
@@ -569,11 +562,10 @@ namespace ts {
|
||||
bindingElements = [];
|
||||
}
|
||||
// Rewrite element to a declaration with an initializer that fetches property
|
||||
// TODO: Probably save the result of createDestructuringPropertyAccess if propName is a computed property
|
||||
const propName = element.propertyName || <Identifier>element.name;
|
||||
const propAccess = createDestructuringPropertyAccess(value, propName);
|
||||
if (isComputedPropertyName(propName)) {
|
||||
(computedTempVariables = computedTempVariables || []).push((propAccess as ElementAccessExpression).argumentExpression);
|
||||
computedTempVariables = append(computedTempVariables, (propAccess as ElementAccessExpression).argumentExpression);
|
||||
}
|
||||
emitBindingElement(element, propAccess);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user