mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Support list/dictionary bracket access
This commit is contained in:
@@ -16,6 +16,9 @@ namespace Microsoft.Iris.DecompXml;
|
|||||||
|
|
||||||
partial class Decompiler
|
partial class Decompiler
|
||||||
{
|
{
|
||||||
|
private static readonly TypeSchema _listType = UIXTypes.MapIDToType(UIXTypeID.List);
|
||||||
|
private static readonly TypeSchema _dictionaryType = UIXTypes.MapIDToType(UIXTypeID.Dictionary);
|
||||||
|
|
||||||
private SyntaxTree DecompileScript(uint startOffset, MarkupTypeSchema export)
|
private SyntaxTree DecompileScript(uint startOffset, MarkupTypeSchema export)
|
||||||
{
|
{
|
||||||
var statements = DecompileMethod(startOffset, export);
|
var statements = DecompileMethod(startOffset, export);
|
||||||
@@ -313,12 +316,22 @@ partial class Decompiler
|
|||||||
_ => stack.Pop(),
|
_ => stack.Pop(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var methodTargetExpression = IrisExpression.ToSyntax(targetObj, _context);
|
||||||
|
|
||||||
|
ExpressionSyntax methodResult;
|
||||||
|
if ((methodSchema.Owner == _listType || methodSchema.Owner == _dictionaryType) && methodSchema.Name == "get_Item")
|
||||||
|
{
|
||||||
|
// Use brackets for list and dictionary indexing
|
||||||
|
methodResult = ElementAccessExpression(methodTargetExpression, BracketedArgumentList([.. parameters]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
var methodExpression = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
|
var methodExpression = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
|
||||||
IrisExpression.ToSyntax(targetObj, _context),
|
methodTargetExpression,
|
||||||
IdentifierName(methodSchema.Name)
|
IdentifierName(methodSchema.Name)
|
||||||
);
|
);
|
||||||
|
methodResult = InvocationExpression(methodExpression, ArgumentList([.. parameters]));
|
||||||
var methodResult = InvocationExpression(methodExpression, ArgumentList([.. parameters]));
|
}
|
||||||
|
|
||||||
if (methodSchema.ReturnType != VoidSchema.Type)
|
if (methodSchema.ReturnType != VoidSchema.Type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -846,7 +846,7 @@
|
|||||||
goto UIB_0097;
|
goto UIB_0097;
|
||||||
source = QuickplayFrameBackground.Value;
|
source = QuickplayFrameBackground.Value;
|
||||||
goto UIB_00AA;
|
goto UIB_00AA;
|
||||||
source = (zuneUI:NamedStringOption)FrameBackgrounds.get_Item(DefaultBackgroundIndex).Value;
|
source = (zuneUI:NamedStringOption)FrameBackgrounds[DefaultBackgroundIndex].Value;
|
||||||
return source;
|
return source;
|
||||||
}</Script>
|
}</Script>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
|
|||||||
Reference in New Issue
Block a user