Fix member access by minus zero

Signed-off-by: hufeng <hufeng20@huawei.com>
Change-Id: Ia7f0fe561b9e0fda0e17aac475d134b6f2a7c108
This commit is contained in:
hufeng
2022-05-14 17:44:47 +08:00
parent 824914f2dd
commit 74d36a35a9
@@ -75,7 +75,7 @@ export function getObjAndProp(node: ts.ElementAccessExpression | ts.PropertyAcce
let expr = node.argumentExpression;
let temp = parseFloat(jshelpers.getTextOfIdentifierOrLiteral(expr.operand));
if (expr.operator == ts.SyntaxKind.MinusToken) {
prop = "-" + temp.toString();
prop = temp === 0 ? temp : "-" + temp.toString();
} else {
if (!isValidIndex(temp)) {
prop = "+" + temp.toString();