mirror of
https://github.com/openharmony/ark_ts2abc.git
synced 2026-07-19 12:33:39 -04:00
!235 Fix member access by minus zero
Merge pull request !235 from hufeng/fix_minus_zero_element
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