File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
Underanalyzer/Decompiler/AST/Nodes Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ public IExpressionNode Clean(ASTCleaner cleaner)
234
234
if ( cleaner . StructArguments is not null )
235
235
{
236
236
// Verify this is an argument array access
237
- if ( instType == ( int ) InstanceType . Argument &&
237
+ if ( instType is ( int ) InstanceType . Argument or ( int ) InstanceType . Self &&
238
238
Variable is { Name . Content : "argument" } &&
239
239
ArrayIndices is [ Int16Node arrayIndex ] )
240
240
{
Original file line number Diff line number Diff line change @@ -2790,4 +2790,49 @@ function Test(arg0) constructor
2790
2790
"""
2791
2791
) ;
2792
2792
}
2793
+
2794
+ [ Fact ]
2795
+ public void TestStructSelfArgument ( )
2796
+ {
2797
+ // Note about this test case: -1 (self) values are generally -15 (arguments), but seems like either
2798
+ // different GameMaker versions or mod tooling(?) generates code that uses self...
2799
+ TestUtil . VerifyDecompileResult (
2800
+ """
2801
+ :[0]
2802
+ call.i @@NewGMLArray@@ 0
2803
+ call.i @@NewGMLArray@@ 0
2804
+ b [2]
2805
+
2806
+ > test_struct (locals=0, args=0)
2807
+ :[1]
2808
+ pushi.e -1
2809
+ pushi.e 0
2810
+ push.v [array]self.argument
2811
+ pop.v.v self.a
2812
+ pushi.e -1
2813
+ pushi.e 1
2814
+ push.v [array]self.argument
2815
+ pop.v.v self.b
2816
+ exit.i
2817
+
2818
+ :[2]
2819
+ push.i [function]test_struct
2820
+ conv.i.v
2821
+ call.i @@NullObject@@ 0
2822
+ call.i method 2
2823
+ dup.v 0
2824
+ pushi.e -16
2825
+ pop.v.v [stacktop]static.test_struct
2826
+ call.i @@NewGMLObject@@ 3
2827
+ pop.v.v self.c
2828
+ """ ,
2829
+ """
2830
+ c =
2831
+ {
2832
+ a: [],
2833
+ b: []
2834
+ };
2835
+ """
2836
+ ) ;
2837
+ }
2793
2838
}
You can’t perform that action at this time.
0 commit comments