Fixed and+dowhile on ASC2 - precontinue can use stack.

This commit is contained in:
Jindra Petřík
2021-02-01 06:30:11 +01:00
parent df3fde1f96
commit dc1ef96e70
17 changed files with 60 additions and 9 deletions

View File

@@ -1848,6 +1848,18 @@ public class Graph {
//makeAllCommands(out2, stack);
makeAllCommands(onTrue, trueStack);
makeAllCommands(onFalse, falseStack);
GraphTargetItem addAfterIf = null;
if (!onTrue.isEmpty() && !onFalse.isEmpty()
&& (onTrue.get(onTrue.size() - 1) instanceof ContinueItem)
&& (onFalse.get(onFalse.size() - 1) instanceof ContinueItem)) {
ContinueItem contTrue = (ContinueItem) onTrue.get(onTrue.size() - 1);
ContinueItem contFalse = (ContinueItem) onFalse.get(onFalse.size() - 1);
if (contTrue.loopId == contFalse.loopId) {
onTrue.remove(onTrue.size() - 1);
onFalse.remove(onFalse.size() - 1);
addAfterIf = contTrue;
}
}
List<GraphTargetItem> filteredOnTrue = filter(onTrue);
List<GraphTargetItem> filteredOnFalse = filter(onFalse);
@@ -1903,6 +1915,9 @@ public class Graph {
}
}
}
if (addAfterIf != null) {
currentRet.add(addAfterIf);
}
//currentRet.addAll(out2);
if (next != null) {
printGraph(foundGotos, partCodes, partCodePos, visited, localData, stack, allParts, part, next, stopPart, loops, currentRet, staticOperation, path, recursionLevel + 1);
@@ -1944,7 +1959,7 @@ public class Graph {
stopContPart.add(currentLoop.loopContinue);
GraphPart precoBackup = currentLoop.loopPreContinue;
currentLoop.loopPreContinue = null;
loopItem.commands.addAll(printGraph(foundGotos, partCodes, partCodePos, visited, localData, new TranslateStack(path), allParts, null, precoBackup, stopContPart, loops, null, staticOperation, path, recursionLevel + 1));
loopItem.commands.addAll(printGraph(foundGotos, partCodes, partCodePos, visited, localData, stack, allParts, null, precoBackup, stopContPart, loops, null, staticOperation, path, recursionLevel + 1));
checkContinueAtTheEnd(loopItem.commands, currentLoop);
}
}

View File

@@ -24,7 +24,7 @@ public class ActionScript3ClassTest extends ActionScript3DecompileTestBase {
@BeforeClass
public void init() throws IOException, InterruptedException {
addSwf("standard", "testdata/flashdevelop/bin/flashdevelop.swf");
addSwf("standard", "testdata/flashdevelop/bin/Main.flex.swf");
}
private void decompileScriptPack(String path, String expectedResult) {

View File

@@ -12,7 +12,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@BeforeClass
public void init() throws IOException, InterruptedException {
addSwf("classic", "testdata/flashdevelop/bin/flashdevelop.swf");
addSwf("classic", "testdata/flashdevelop/bin/Main.flex.swf");
}
@Test

View File

@@ -21,7 +21,7 @@ public class ActionScript3OptinalParametersTest extends ActionScript3DecompileTe
@BeforeClass
public void init() throws IOException, InterruptedException {
addSwf("standard", "testdata/flashdevelop/bin/flashdevelop.swf");
addSwf("standard", "testdata/flashdevelop/bin/Main.flex.swf");
}
@Test
public void testOptionalParameters() {

View File

@@ -170,7 +170,7 @@ public class AS3Generator {
Configuration.autoDeobfuscate.set(false);
useFile("ActionScript3ClassicDecompileTest", new String[][]{{"testdata/flashdevelop/bin/flashdevelop.swf", "classic"}}, false);
useFile("ActionScript3ClassicDecompileTest", new String[][]{{"testdata/flashdevelop/bin/Main.flex.swf", "classic"}}, false);
useFile("ActionScript3CrossCompileDecompileTest", new String[][]{
{"testdata/cross_compile/bin/Main.flex.swf", "flex"},
{"testdata/cross_compile/bin/Main.air.swf", "air"}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
@echo off
set COMPILERKIND=air
call c:\air\bin\mxmlc.bat -warnings=false -debug=true -output bin/Main.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1

View File

@@ -0,0 +1,3 @@
@echo off
set COMPILERKIND=flex
c:\flex\bin\mxmlc.exe -warnings=false -debug=true -output bin/Main.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1

View File

@@ -4,7 +4,7 @@
<output>
<movie outputType="Application" />
<movie input="" />
<movie path="bin\flashdevelop.swf" />
<movie path="bin\Main.flex.swf" />
<movie fps="30" />
<movie width="800" />
<movie height="600" />
@@ -12,6 +12,7 @@
<movie minorVersion="0" />
<movie platform="Flash Player" />
<movie background="#FFFFFF" />
<movie preferredSDK="Flex 4.6.0, AIR 3.1;4.6.0, 3.1;" />
</output>
<!-- Other classes to be compiled into your SWF -->
<classpaths>
@@ -81,7 +82,7 @@
<!-- Executed before build -->
<preBuildCommand />
<!-- Executed after build -->
<postBuildCommand alwaysRun="False" />
<postBuildCommand alwaysRun="False">build_air_debug.bat</postBuildCommand>
<!-- Other project options -->
<options>
<option showHiddenPaths="False" />

View File

@@ -3,6 +3,8 @@
<!--Any modifications you make may be lost.-->
<flex-config>
<target-player>25.0</target-player>
<benchmark>false</benchmark>
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<compiler>
<define append="true">
<name>CONFIG::debug</name>
@@ -14,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
<value>'29.01.2021'</value>
<value>'01.02.2021'</value>
</define>
<define append="true">
<name>CONFIG::air</name>

View File

@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
<value>'29.01.2021'</value>
<value>'01.02.2021'</value>
</define>
<define append="true">
<name>CONFIG::air</name>

View File

@@ -24,6 +24,7 @@ package
TestDefaultNotLastGrouped;
TestDoWhile;
TestDoWhile2;
TestDoWhile3;
TestExpressions;
TestFinallyZeroJump;
TestFor;

View File

@@ -0,0 +1,26 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestDoWhile3
{
private var ch:String;
public function run() : void
{
do
{
nextChar();
} while ( ch != '\n' && ch != '' )
}
private function nextChar() : void
{
trace("process next char");
}
}
}