Skip to content

Commit 2fd7ccf

Browse files
committed
Use strings for namespace disambiguation in AS3
Also cleans up memory rather than leaking it now
1 parent 03613ee commit 2fd7ccf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+638
-338
lines changed

ANEBytecodeEditorSWC.as3proj

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<project version="2">
3+
<!-- Output SWF options -->
4+
<output>
5+
<movie outputType="CustomBuild" />
6+
<movie input="" />
7+
<movie path="ANEBytecodeEditor.swc" />
8+
<movie fps="0" />
9+
<movie width="0" />
10+
<movie height="0" />
11+
<movie version="17" />
12+
<movie minorVersion="0" />
13+
<movie platform="AIR" />
14+
<movie background="#FFFFFF" />
15+
</output>
16+
<!-- Other classes to be compiled into your SWF -->
17+
<classpaths>
18+
<class path="src" />
19+
</classpaths>
20+
<!-- Build options -->
21+
<build>
22+
<option accessible="False" />
23+
<option advancedTelemetry="False" />
24+
<option allowSourcePathOverlap="False" />
25+
<option benchmark="False" />
26+
<option es="False" />
27+
<option inline="False" />
28+
<option locale="" />
29+
<option loadConfig="" />
30+
<option optimize="True" />
31+
<option omitTraces="True" />
32+
<option showActionScriptWarnings="True" />
33+
<option showBindingWarnings="True" />
34+
<option showInvalidCSS="True" />
35+
<option showDeprecationWarnings="True" />
36+
<option showUnusedTypeSelectorWarnings="True" />
37+
<option strict="True" />
38+
<option useNetwork="True" />
39+
<option useResourceBundleMetadata="True" />
40+
<option warnings="True" />
41+
<option verboseStackTraces="False" />
42+
<option linkReport="" />
43+
<option loadExterns="" />
44+
<option staticLinkRSL="True" />
45+
<option additional="-swf-version=11&#xA;--" />
46+
<option compilerConstants="" />
47+
<option minorVersion="" />
48+
</build>
49+
<!-- SWC Include Libraries -->
50+
<includeLibraries>
51+
<!-- example: <element path="..." /> -->
52+
</includeLibraries>
53+
<!-- SWC Libraries -->
54+
<libraryPaths>
55+
<!-- example: <element path="..." /> -->
56+
</libraryPaths>
57+
<!-- External Libraries -->
58+
<externalLibraryPaths>
59+
<!-- example: <element path="..." /> -->
60+
</externalLibraryPaths>
61+
<!-- Runtime Shared Libraries -->
62+
<rslPaths>
63+
<!-- example: <element path="..." /> -->
64+
</rslPaths>
65+
<!-- Intrinsic Libraries -->
66+
<intrinsics>
67+
<!-- example: <element path="..." /> -->
68+
</intrinsics>
69+
<!-- Assets to embed into the output SWF -->
70+
<library>
71+
<!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
72+
</library>
73+
<!-- Class files to compile (other referenced classes will automatically be included) -->
74+
<compileTargets>
75+
<!-- example: <compile path="..." /> -->
76+
</compileTargets>
77+
<!-- Paths to exclude from the Project Explorer tree -->
78+
<hiddenPaths>
79+
<hidden path="obj" />
80+
</hiddenPaths>
81+
<!-- Executed before build -->
82+
<preBuildCommand>"$(BaseDir)\Tools\swcbuild\swcbuild.exe" "$(ProjectPath)" "-compiler=$(CompilerPath)" "-debug=$(BuildConfig)" "-library=C:\Program Files (x86)\FlashDevelop\Library" -asdoc=true -keep-asdoc=false</preBuildCommand>
83+
<!-- Executed after build -->
84+
<postBuildCommand alwaysRun="False" />
85+
<!-- Other project options -->
86+
<options>
87+
<option showHiddenPaths="False" />
88+
<option testMovie="Unknown" />
89+
<option testMovieCommand="" />
90+
</options>
91+
<!-- Plugin storage -->
92+
<storage />
93+
</project>

AS3/src/com/cff/anebe/ir/ASNamespace.as

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ package com.cff.anebe.ir
1212
/** Namespace name. */
1313
public var name:String;
1414

15-
/** If there are multiple namespaces with the same name, disambiguates them. This should only very rarely be non-zero. */
16-
public var id:int = 0;
15+
/** If there are multiple namespaces with the same name, disambiguates them. This should only very rarely be non-null. */
16+
public var secondaryName:String;
1717

1818
/** Type string for private namespaces */
1919
public static const TYPE_PRIVATE:String = "PrivateNamespace";
@@ -40,13 +40,13 @@ package com.cff.anebe.ir
4040
* Builds an ASNamespace from scratch. Should probably not be used; see instead helper functions in the package com.cff.anebe.ir.namespaces
4141
* @param type Namespace type
4242
* @param name Namespace name
43-
* @param id Disambiguation ID
43+
* @param secondaryName Namespace secondary name, if disambiguation is required
4444
*/
45-
public function ASNamespace(type:String, name:String, id:int = 0)
45+
public function ASNamespace(type:String, name:String, secondaryName:String = null)
4646
{
4747
this.type = type;
4848
this.name = name;
49-
this.id = id;
49+
this.secondaryName = secondaryName;
5050
}
5151
}
5252
}

AS3/src/com/cff/anebe/ir/namespaces/ExplicitNamespace.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents an ExplicitNamespace
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function ExplicitNamespace(name:String, id:int = 0):ASNamespace
11+
public function ExplicitNamespace(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_EXPLICIT, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_EXPLICIT, name, disambiguator);
1414
}
1515
}

AS3/src/com/cff/anebe/ir/namespaces/NormalNamespace.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents a Namespace
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function NormalNamespace(name:String, id:int = 0):ASNamespace
11+
public function NormalNamespace(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_NORMAL, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_NORMAL, name, disambiguator);
1414
}
1515
}

AS3/src/com/cff/anebe/ir/namespaces/PackageInternalNs.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents a PackageInternalNs
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function PackageInternalNs(name:String, id:int = 0):ASNamespace
11+
public function PackageInternalNs(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_PACKAGEINTERNAL, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_PACKAGEINTERNAL, name, disambiguator);
1414
}
1515
}

AS3/src/com/cff/anebe/ir/namespaces/PackageNamespace.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents a PackageNamespace
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function PackageNamespace(name:String, id:int = 0):ASNamespace
11+
public function PackageNamespace(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_PACKAGE, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_PACKAGE, name, disambiguator);
1414
}
1515
}

AS3/src/com/cff/anebe/ir/namespaces/PrivateNamespace.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents an PrivateNamespace
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function PrivateNamespace(name:String, id:int = 0):ASNamespace
11+
public function PrivateNamespace(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_PRIVATE, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_PRIVATE, name, disambiguator);
1414
}
1515
}

AS3/src/com/cff/anebe/ir/namespaces/ProtectedNamespace.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents a ProtectedNamespace
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function ProtectedNamespace(name:String, id:int = 0):ASNamespace
11+
public function ProtectedNamespace(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_PROTECTED, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_PROTECTED, name, disambiguator);
1414
}
1515
}

AS3/src/com/cff/anebe/ir/namespaces/StaticProtectedNs.as

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ package com.cff.anebe.ir.namespaces
55
/**
66
* Builds an ASNamespace that represents a StaticProtectedNs
77
* @param name Name of the namespace
8-
* @param id If there are multiple of the same namespace name and type, disambiguates between them; should almost always be zero
8+
* @param disambiguator If there are multiple of the same namespace name and type, disambiguates between them; should almost always be null
99
* @return Built ASNamespace
1010
*/
11-
public function StaticProtectedNs(name:String, id:int = 0):ASNamespace
11+
public function StaticProtectedNs(name:String, disambiguator:String = null):ASNamespace
1212
{
13-
return new ASNamespace(ASNamespace.TYPE_STATICPROTECTED, name, id);
13+
return new ASNamespace(ASNamespace.TYPE_STATICPROTECTED, name, disambiguator);
1414
}
1515
}

Native/BytecodeEditor/BytecodeEditor.vcxproj

+2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@
160160
<ClInclude Include="include\enums\TraitAttribute.hpp" />
161161
<ClInclude Include="include\enums\TraitKind.hpp" />
162162
<ClInclude Include="include\SWF\SWFFile.hpp" />
163+
<ClInclude Include="include\utils\ANEFunctionContext.hpp" />
163164
<ClInclude Include="include\utils\ANEUtils.hpp" />
164165
<ClInclude Include="include\utils\BidirectionalMap.hpp" />
166+
<ClInclude Include="include\utils\generic_hash.hpp" />
165167
<ClInclude Include="include\utils\RefBuilder.hpp" />
166168
<ClInclude Include="include\utils\SmallTrivialVector.hpp" />
167169
<ClInclude Include="include\utils\StringBuilder.hpp" />

Native/BytecodeEditor/include/ABC/ABCFile.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <stdint.h>
1212
#include <string>
1313

14-
namespace ABC
14+
namespace SWFABC
1515
{
1616
struct ABCFile
1717
{

Native/BytecodeEditor/include/ABC/ABCReader.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <stdint.h>
3333
#include <string>
3434

35-
namespace ABC
35+
namespace SWFABC
3636
{
3737
class ABCReader
3838
{

Native/BytecodeEditor/include/ABC/ABCWriter.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <stdint.h>
3131
#include <string>
3232

33-
namespace ABC
33+
namespace SWFABC
3434
{
3535
class ABCWriter
3636
{

Native/BytecodeEditor/include/ABC/Class.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdint.h>
55
#include <vector>
66

7-
namespace ABC
7+
namespace SWFABC
88
{
99
struct Class
1010
{

Native/BytecodeEditor/include/ABC/Error.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "ABC/Label.hpp"
44
#include <string>
55

6-
namespace ABC
6+
namespace SWFABC
77
{
88
struct Error
99
{

Native/BytecodeEditor/include/ABC/ExceptionInfo.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "ABC/Label.hpp"
44
#include <stdint.h>
55

6-
namespace ABC
6+
namespace SWFABC
77
{
88
struct ExceptionInfo
99
{

Native/BytecodeEditor/include/ABC/Instance.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdint.h>
55
#include <vector>
66

7-
namespace ABC
7+
namespace SWFABC
88
{
99
struct Instance
1010
{

Native/BytecodeEditor/include/ABC/Instruction.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <variant>
77
#include <vector>
88

9-
namespace ABC
9+
namespace SWFABC
1010
{
1111
struct Instruction
1212
{

Native/BytecodeEditor/include/ABC/Label.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3-
#include <stdint.h>
43
#include <compare>
4+
#include <stdint.h>
55

6-
namespace ABC
6+
namespace SWFABC
77
{
88
struct Label
99
{

Native/BytecodeEditor/include/ABC/Metadata.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <stdint.h>
44
#include <vector>
55

6-
namespace ABC
6+
namespace SWFABC
77
{
88
struct Metadata
99
{

Native/BytecodeEditor/include/ABC/MethodBody.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <stdint.h>
88
#include <vector>
99

10-
namespace ABC
10+
namespace SWFABC
1111
{
1212
struct MethodBody
1313
{

Native/BytecodeEditor/include/ABC/MethodInfo.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdint.h>
55
#include <vector>
66

7-
namespace ABC
7+
namespace SWFABC
88
{
99
struct MethodInfo
1010
{

Native/BytecodeEditor/include/ABC/Multiname.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <variant>
66
#include <vector>
77

8-
namespace ABC
8+
namespace SWFABC
99
{
1010
struct Multiname
1111
{

Native/BytecodeEditor/include/ABC/Namespace.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "enums/ABCType.hpp"
44
#include <stdint.h>
55

6-
namespace ABC
6+
namespace SWFABC
77
{
88
struct Namespace
99
{

Native/BytecodeEditor/include/ABC/OptionDetail.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "enums/ABCType.hpp"
44
#include <stdint.h>
55

6-
namespace ABC
6+
namespace SWFABC
77
{
88
struct OptionDetail
99
{

Native/BytecodeEditor/include/ABC/Script.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdint.h>
55
#include <vector>
66

7-
namespace ABC
7+
namespace SWFABC
88
{
99
struct Script
1010
{

Native/BytecodeEditor/include/ABC/TraitsInfo.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <stdint.h>
66
#include <vector>
77

8-
namespace ABC
8+
namespace SWFABC
99
{
1010
struct TraitsInfo
1111
{

0 commit comments

Comments
 (0)