mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 23:21:36 +00:00
item getResult fix
This commit is contained in:
+5
-3
@@ -63,10 +63,12 @@ public class AddAVM2Item extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
if (EcmaScript.type(leftSide.getResult()) == EcmaType.STRING || EcmaScript.type(rightSide.getResult()) == EcmaType.STRING) {
|
||||
return "" + leftSide.getResult() + rightSide.getResult();
|
||||
Object leftResult = leftSide.getResult();
|
||||
Object rightResult = rightSide.getResult();
|
||||
if (EcmaScript.type(leftResult) == EcmaType.STRING || EcmaScript.type(rightResult) == EcmaType.STRING) {
|
||||
return "" + leftResult + rightResult;
|
||||
}
|
||||
return EcmaScript.toNumber(leftSide.getResult()) + EcmaScript.toNumber(rightSide.getResult());
|
||||
return EcmaScript.toNumber(leftResult) + EcmaScript.toNumber(rightResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-6
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -37,10 +38,11 @@ public class DivideAVM2Item extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
if (Double.compare(EcmaScript.toNumber(rightSide.getResult()), 0) == 0) {
|
||||
Object rightResult = rightSide.getResult();
|
||||
if (Double.compare(EcmaScript.toNumber(rightResult), 0) == 0) {
|
||||
return Double.NaN;
|
||||
}
|
||||
return (EcmaScript.toNumber(leftSide.getResult())) / (EcmaScript.toNumber(rightSide.getResult()));
|
||||
return (EcmaScript.toNumber(leftSide.getResult())) / (EcmaScript.toNumber(rightResult));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-6
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -37,10 +38,11 @@ public class ModuloAVM2Item extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
if (Double.compare(EcmaScript.toNumber(rightSide.getResult()), 0) == 0) {
|
||||
Object rightResult = rightSide.getResult();
|
||||
if (Double.compare(EcmaScript.toNumber(rightResult), 0) == 0) {
|
||||
return Double.NaN;
|
||||
}
|
||||
return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) % ((long) (double) EcmaScript.toNumber(rightSide.getResult()));
|
||||
return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) % ((long) (double) EcmaScript.toNumber(rightResult));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-7
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -63,10 +64,12 @@ public class AddActionItem extends BinaryOpItem {
|
||||
@Override
|
||||
public Object getResult() {
|
||||
if (version2) {
|
||||
if (EcmaScript.type(leftSide.getResult()) == EcmaType.STRING || EcmaScript.type(rightSide.getResult()) == EcmaType.STRING) {
|
||||
return "" + leftSide.getResult() + rightSide.getResult();
|
||||
Object leftResult = leftSide.getResult();
|
||||
Object rightResult = rightSide.getResult();
|
||||
if (EcmaScript.type(leftResult) == EcmaType.STRING || EcmaScript.type(rightResult) == EcmaType.STRING) {
|
||||
return "" + leftResult + rightResult;
|
||||
}
|
||||
return EcmaScript.toNumber(leftSide.getResult()) + EcmaScript.toNumber(rightSide.getResult());
|
||||
return EcmaScript.toNumber(leftResult) + EcmaScript.toNumber(rightResult);
|
||||
} else {
|
||||
return Action.toFloatPoint(leftSide.getResult()) + Action.toFloatPoint(rightSide.getResult());
|
||||
}
|
||||
|
||||
+8
-6
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -34,10 +35,11 @@ public class DivideActionItem extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
if (Double.compare(EcmaScript.toNumber(rightSide.getResult()), 0) == 0) {
|
||||
Object rightResult = rightSide.getResult();
|
||||
if (Double.compare(EcmaScript.toNumber(rightResult), 0) == 0) {
|
||||
return Double.NaN;
|
||||
}
|
||||
return (EcmaScript.toNumber(leftSide.getResult())) / (EcmaScript.toNumber(rightSide.getResult()));
|
||||
return (EcmaScript.toNumber(leftSide.getResult())) / (EcmaScript.toNumber(rightResult));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-6
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model.operations;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -34,10 +35,11 @@ public class ModuloActionItem extends BinaryOpItem {
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
if (Double.compare(EcmaScript.toNumber(rightSide.getResult()), 0) == 0) {
|
||||
Object rightResult = rightSide.getResult();
|
||||
if (Double.compare(EcmaScript.toNumber(rightResult), 0) == 0) {
|
||||
return Double.NaN;
|
||||
}
|
||||
return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) % ((long) (double) EcmaScript.toNumber(rightSide.getResult()));
|
||||
return ((long) (double) EcmaScript.toNumber(leftSide.getResult())) % ((long) (double) EcmaScript.toNumber(rightResult));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user