Fixed AS3 Metadata values order

This commit is contained in:
Jindra Petřík
2023-02-28 21:34:20 +01:00
parent 9e6fa2e75b
commit aee2f18016
8 changed files with 30 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
- AS3 direct editation - Allow comma operator in XML filter operation
- AS3 direct editation - Allow comma operator in switch expressions
- AS3 XML embedded variables display and direct edit
- AS3 Metadata values order
## [18.3.6] - 2023-02-25
### Fixed

View File

@@ -45,6 +45,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -102,7 +103,7 @@ public abstract class Trait implements Cloneable, Serializable {
for (int m : metadata) {
if (m >= 0 && m < abc.metadata_info.size()) {
String name = abc.constants.getString(abc.metadata_info.get(m).name_index);
Map<String, String> data = new HashMap<>();
Map<String, String> data = new LinkedHashMap<>();
for (int i = 0; i < abc.metadata_info.get(m).keys.length; i++) {
data.put(abc.constants.getString(abc.metadata_info.get(m).keys[i]),
abc.constants.getString(abc.metadata_info.get(m).values[i]));

View File

@@ -1383,6 +1383,12 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
false);
}
@Test
public void testMetadata() {
decompileMethod("classic_air", "testMetadata", "trace(\"hello\");\r\n",
false);
}
@Test
public void testMissingDefault() {
decompileMethod("classic_air", "testMissingDefault", "var jj:int = 1;\r\n"

View File

@@ -1379,6 +1379,12 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
false);
}
@Test
public void testMetadata() {
decompileMethod("classic", "testMetadata", "trace(\"hello\");\r\n",
false);
}
@Test
public void testMissingDefault() {
decompileMethod("classic", "testMissingDefault", "var jj:int = 1;\r\n"

View File

@@ -83,6 +83,7 @@ package
TestInnerTry;
TestLogicalComputing;
TestManualConvert;
TestMetadata;
TestMissingDefault;
TestMultipleCondition;
TestNamedAnonFunctions;

View File

@@ -0,0 +1,14 @@
package tests
{
[MyClassTag(cls1 = "class 1", cls2 = "class 2")]
public class TestMetadata
{
[MyVarTag(var1 = "var 1", var2 = "var 2")]
public var v:int = 5;
public function run(): void
{
trace("hello");
}
}
}