mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Move common decompiler state to new class
This commit is contained in:
@@ -19,10 +19,10 @@ internal class IrisConstantExpression : IrisExpression, IReturnValueProvider
|
||||
|
||||
public TypeSchema ReturnType => TypeSchema;
|
||||
|
||||
public override string Decompile(Decompiler decompiler)
|
||||
public override string Decompile(DecompileContext context)
|
||||
{
|
||||
if (TypeSchema.IsEnum)
|
||||
return $"{decompiler.GetQualifiedName(TypeSchema)}.{Value}";
|
||||
return $"{context.GetQualifiedName(TypeSchema)}.{Value}";
|
||||
|
||||
return Value switch
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Microsoft.Iris.DecompXml.Mock;
|
||||
|
||||
internal class IrisExpression : Expression
|
||||
{
|
||||
public virtual string Decompile(Decompiler decompiler) => ToString();
|
||||
public virtual string Decompile(DecompileContext context) => ToString();
|
||||
|
||||
public static Expression ToExpression(object p)
|
||||
{
|
||||
|
||||
@@ -29,11 +29,11 @@ internal class IrisMethodCallExpression : IrisExpression, IArgumentProvider, IRe
|
||||
|
||||
public Expression GetArgument(int index) => _arguments[index];
|
||||
|
||||
public override string Decompile(Decompiler decompiler)
|
||||
public override string Decompile(DecompileContext context)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
var qfn = decompiler.GetQualifiedName(Method.Owner);
|
||||
var qfn = context.GetQualifiedName(Method.Owner);
|
||||
sb.Append(qfn);
|
||||
sb.Append('.');
|
||||
sb.Append(Method.Name);
|
||||
@@ -47,7 +47,7 @@ internal class IrisMethodCallExpression : IrisExpression, IArgumentProvider, IRe
|
||||
string exprToString(Expression x)
|
||||
{
|
||||
return x is IrisExpression irisExpr
|
||||
? irisExpr.Decompile(decompiler)
|
||||
? irisExpr.Decompile(context)
|
||||
: x.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using Microsoft.Iris.Asm;
|
||||
using Microsoft.Iris.Markup;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Microsoft.Iris.DecompXml.Mock;
|
||||
|
||||
internal record IrisObject(object Object, TypeSchema Type)
|
||||
{
|
||||
public static IrisObject Create(object objIn, TypeSchema type, Decompiler decompiler)
|
||||
public static IrisObject Create(object objIn, TypeSchema type, DecompileContext context)
|
||||
{
|
||||
object obj = objIn;
|
||||
|
||||
@@ -31,7 +27,7 @@ internal record IrisObject(object Object, TypeSchema Type)
|
||||
type ??= hasReturnValue.ReturnType;
|
||||
}
|
||||
|
||||
type ??= Disassembler.GuessTypeSchema(obj.GetType(), decompiler._loadResult);
|
||||
type ??= Disassembler.GuessTypeSchema(obj.GetType(), context.LoadResult);
|
||||
|
||||
return new(obj, type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user