mirror of
https://github.com/openharmony/ark_ts2abc.git
synced 2026-07-21 08:25:24 -04:00
Fix member access by minus zero
Signed-off-by: hufeng <hufeng20@huawei.com> Change-Id: Ia7f0fe561b9e0fda0e17aac475d134b6f2a7c108
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user