Skip to content

Commit a39f9ef

Browse files
author
Kanchalai Tanglertsampan
committed
Update calling to getSpreadType and using set function when adding value to map
1 parent a44c3f2 commit a39f9ef

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/compiler/checker.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11903,13 +11903,13 @@ namespace ts {
1190311903
}
1190411904
attributeSymbol.type = exprType;
1190511905
attributeSymbol.target = member;
11906-
attributesTable[attributeSymbol.name] = attributeSymbol;
11906+
attributesTable.set(attributeSymbol.name, attributeSymbol);
1190711907
attributesArray.push(attributeSymbol);
1190811908
}
1190911909
else {
1191011910
Debug.assert(attributeDecl.kind === SyntaxKind.JsxSpreadAttribute);
1191111911
if (attributesArray.length > 0) {
11912-
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), /*isFromObjectLiteral*/ true);
11912+
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable));
1191311913
attributesArray = [];
1191411914
attributesTable = createMap<Symbol>();
1191511915
}
@@ -11922,13 +11922,13 @@ namespace ts {
1192211922
if (isTypeAny(widenExprType)) {
1192311923
return undefined;
1192411924
}
11925-
spread = getSpreadType(spread, exprType, /*isFromObjectLiteral*/ false);
11925+
spread = getSpreadType(spread, exprType);
1192611926
}
1192711927
}
1192811928

1192911929
if (spread !== emptyObjectType) {
1193011930
if (attributesArray.length > 0) {
11931-
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable), /*isFromObjectLiteral*/ true);
11931+
spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable));
1193211932
attributesArray = [];
1193311933
attributesTable = createMap<Symbol>();
1193411934
}
@@ -11962,7 +11962,7 @@ namespace ts {
1196211962
if (symbolArray) {
1196311963
const symbolTable = createMap<Symbol>();
1196411964
forEach(symbolArray, (attr) => {
11965-
symbolTable[attr.name] = attr;
11965+
symbolTable.set(attr.name, attr);
1196611966
});
1196711967
argAttributesType = createJsxAttributesType(node.symbol, symbolTable);
1196811968
}
@@ -11986,7 +11986,7 @@ namespace ts {
1198611986
}
1198711987

1198811988
const symbolArray = getJsxAttributesSymbolArrayFromAttributesProperty(openingLikeElement);
11989-
// sourceAttributesType is a type of an attributes properties.
11989+
// sourceAttributesType is a type of attributes properties.
1199011990
// i.e <div attr1={10} attr2="string" />
1199111991
// attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". They resolved to be sourceAttributesType.
1199211992
let sourceAttributesType = anyType as Type;
@@ -11996,7 +11996,7 @@ namespace ts {
1199611996
const symbolTable = createMap<Symbol>();
1199711997
forEach(symbolArray, (attr) => {
1199811998
if (isUnhyphenatedJsxName(attr.name) || getPropertyOfType(targetAttributesType, attr.name)) {
11999-
symbolTable[attr.name] = attr;
11999+
symbolTable.set(attr.name, attr);
1200012000
isSourceAttributesTypeEmpty = false;
1200112001
}
1200212002
});
@@ -12450,7 +12450,7 @@ namespace ts {
1245012450
}
1245112451
}
1245212452

12453-
checkJSXAttributesAssignableToTagnameAttributes(openingLikeElement);
12453+
checkJSXAttributesAssignableToTagnameAttributes(node);
1245412454
}
1245512455

1245612456
function checkJsxExpression(node: JsxExpression) {

src/harness/harness.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,13 +1011,13 @@ namespace Harness {
10111011
const libFileName = "tests/lib/" + fileName;
10121012

10131013
if (scriptTarget <= ts.ScriptTarget.ES5) {
1014-
if (!testLibFileNameSourceFileMap[libFileName]) {
1015-
testLibFileNameSourceFileMap[libFileName] = createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget);
1014+
if (!testLibFileNameSourceFileMap.get(libFileName)) {
1015+
testLibFileNameSourceFileMap.set(libFileName, createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget));
10161016
}
10171017
}
10181018
else {
1019-
if (!es6TestLibFileNameSourceFileMap[libFileName]) {
1020-
es6TestLibFileNameSourceFileMap[libFileName] = createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget);
1019+
if (!es6TestLibFileNameSourceFileMap.get(libFileName)) {
1020+
es6TestLibFileNameSourceFileMap.set(libFileName, createSourceFileAndAssertInvariants(libFileName, IO.readFile(libFileName), scriptTarget))
10211021
}
10221022
}
10231023
}
@@ -1035,7 +1035,7 @@ namespace Harness {
10351035
return fourslashSourceFile;
10361036
}
10371037
else if (ts.startsWith(fileName, "tests/lib/")) {
1038-
return scriptTarget <= ts.ScriptTarget.ES5 ? testLibFileNameSourceFileMap[fileName] : es6TestLibFileNameSourceFileMap[fileName];
1038+
return scriptTarget <= ts.ScriptTarget.ES5 ? testLibFileNameSourceFileMap.get(fileName) : es6TestLibFileNameSourceFileMap.get(fileName);
10391039
}
10401040
else {
10411041
// Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ namespace ts {
20072007
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
20082008
const nameExpression = (<ComputedPropertyName>node.name).expression;
20092009
// treat computed property names where expression is string/numeric literal as just string/numeric literal
2010-
if (isStringOrNumericLiteral(nameExpression.kind)) {
2010+
if (isStringOrNumericLiteral(nameExpression)) {
20112011
return (<LiteralExpression>nameExpression).text;
20122012
}
20132013
return undefined;

0 commit comments

Comments
 (0)