mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Update calling to getSpreadType and using set function when adding value to map
This commit is contained in:
@@ -11903,13 +11903,13 @@ namespace ts {
|
||||
}
|
||||
attributeSymbol.type = exprType;
|
||||
attributeSymbol.target = member;
|
||||
attributesTable[attributeSymbol.name] = attributeSymbol;
|
||||
attributesTable.set(attributeSymbol.name, attributeSymbol);
|
||||
attributesArray.push(attributeSymbol);
|
||||
}
|
||||
else {
|
||||
Debug.assert(attributeDecl.kind === SyntaxKind.JsxSpreadAttribute);
|
||||
if (attributesArray.length > 0) {
|
||||
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), /*isFromObjectLiteral*/ true);
|
||||
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable));
|
||||
attributesArray = [];
|
||||
attributesTable = createMap<Symbol>();
|
||||
}
|
||||
@@ -11922,13 +11922,13 @@ namespace ts {
|
||||
if (isTypeAny(widenExprType)) {
|
||||
return undefined;
|
||||
}
|
||||
spread = getSpreadType(spread, exprType, /*isFromObjectLiteral*/ false);
|
||||
spread = getSpreadType(spread, exprType);
|
||||
}
|
||||
}
|
||||
|
||||
if (spread !== emptyObjectType) {
|
||||
if (attributesArray.length > 0) {
|
||||
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), /*isFromObjectLiteral*/ true);
|
||||
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable));
|
||||
attributesArray = [];
|
||||
attributesTable = createMap<Symbol>();
|
||||
}
|
||||
@@ -11962,7 +11962,7 @@ namespace ts {
|
||||
if (symbolArray) {
|
||||
const symbolTable = createMap<Symbol>();
|
||||
forEach(symbolArray, (attr) => {
|
||||
symbolTable[attr.name] = attr;
|
||||
symbolTable.set(attr.name, attr);
|
||||
});
|
||||
argAttributesType = createJsxAttributesType(node.symbol, symbolTable);
|
||||
}
|
||||
@@ -11986,7 +11986,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
const symbolArray = getJsxAttributesSymbolArrayFromAttributesProperty(openingLikeElement);
|
||||
// sourceAttributesType is a type of an attributes properties.
|
||||
// sourceAttributesType is a type of attributes properties.
|
||||
// i.e <div attr1={10} attr2="string" />
|
||||
// attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". They resolved to be sourceAttributesType.
|
||||
let sourceAttributesType = anyType as Type;
|
||||
@@ -11996,7 +11996,7 @@ namespace ts {
|
||||
const symbolTable = createMap<Symbol>();
|
||||
forEach(symbolArray, (attr) => {
|
||||
if (isUnhyphenatedJsxName(attr.name) || getPropertyOfType(targetAttributesType, attr.name)) {
|
||||
symbolTable[attr.name] = attr;
|
||||
symbolTable.set(attr.name, attr);
|
||||
isSourceAttributesTypeEmpty = false;
|
||||
}
|
||||
});
|
||||
@@ -12450,7 +12450,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
checkJSXAttributesAssignableToTagnameAttributes(openingLikeElement);
|
||||
checkJSXAttributesAssignableToTagnameAttributes(node);
|
||||
}
|
||||
|
||||
function checkJsxExpression(node: JsxExpression) {
|
||||
|
||||
@@ -1011,13 +1011,13 @@ namespace Harness {
|
||||
const libFileName = "tests/lib/" + fileName;
|
||||
|
||||
if (scriptTarget <= ts.ScriptTarget.ES5) {
|
||||
if (!testLibFileNameSourceFileMap[libFileName]) {
|
||||
testLibFileNameSourceFileMap[libFileName] = createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget);
|
||||
if (!testLibFileNameSourceFileMap.get(libFileName)) {
|
||||
testLibFileNameSourceFileMap.set(libFileName, createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!es6TestLibFileNameSourceFileMap[libFileName]) {
|
||||
es6TestLibFileNameSourceFileMap[libFileName] = createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget);
|
||||
if (!es6TestLibFileNameSourceFileMap.get(libFileName)) {
|
||||
es6TestLibFileNameSourceFileMap.set(libFileName, createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1035,7 +1035,7 @@ namespace Harness {
|
||||
return fourslashSourceFile;
|
||||
}
|
||||
else if (ts.startsWith(fileName, "tests/lib/")) {
|
||||
return scriptTarget <= ts.ScriptTarget.ES5 ? testLibFileNameSourceFileMap[fileName] : es6TestLibFileNameSourceFileMap[fileName];
|
||||
return scriptTarget <= ts.ScriptTarget.ES5 ? testLibFileNameSourceFileMap.get(fileName) : es6TestLibFileNameSourceFileMap.get(fileName);
|
||||
}
|
||||
else {
|
||||
// Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC
|
||||
|
||||
@@ -2007,7 +2007,7 @@ namespace ts {
|
||||
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
const nameExpression = (<ComputedPropertyName>node.name).expression;
|
||||
// treat computed property names where expression is string/numeric literal as just string/numeric literal
|
||||
if (isStringOrNumericLiteral(nameExpression.kind)) {
|
||||
if (isStringOrNumericLiteral(nameExpression)) {
|
||||
return (<LiteralExpression>nameExpression).text;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user