mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-11-27 03:12:22 -05:00
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
This commit is contained in:
@@ -4,12 +4,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ArraySubscriptingExpression : BaseNode
|
||||
{
|
||||
private BaseNode _leftNode;
|
||||
private BaseNode _subscript;
|
||||
private readonly BaseNode _leftNode;
|
||||
private readonly BaseNode _subscript;
|
||||
|
||||
public ArraySubscriptingExpression(BaseNode leftNode, BaseNode subscript) : base(NodeType.ArraySubscriptingExpression)
|
||||
{
|
||||
_leftNode = leftNode;
|
||||
_leftNode = leftNode;
|
||||
_subscript = subscript;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_leftNode.Print(writer);
|
||||
writer.Write(")[");
|
||||
_subscript.Print(writer);
|
||||
writer.Write("]");
|
||||
writer.Write("]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ArrayType : BaseNode
|
||||
{
|
||||
private BaseNode _base;
|
||||
private BaseNode _dimensionExpression;
|
||||
private string _dimensionString;
|
||||
private readonly BaseNode _base;
|
||||
private readonly BaseNode _dimensionExpression;
|
||||
private readonly string _dimensionString;
|
||||
|
||||
public ArrayType(BaseNode Base, BaseNode dimensionExpression = null) : base(NodeType.ArrayType)
|
||||
{
|
||||
_base = Base;
|
||||
_base = Base;
|
||||
_dimensionExpression = dimensionExpression;
|
||||
}
|
||||
|
||||
public ArrayType(BaseNode Base, string dimensionString) : base(NodeType.ArrayType)
|
||||
{
|
||||
_base = Base;
|
||||
_base = Base;
|
||||
_dimensionString = dimensionString;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
writer.Write(_dimensionString);
|
||||
}
|
||||
else if (_dimensionExpression != null)
|
||||
else
|
||||
{
|
||||
_dimensionExpression.Print(writer);
|
||||
_dimensionExpression?.Print(writer);
|
||||
}
|
||||
|
||||
writer.Write("]");
|
||||
@@ -56,4 +56,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_base.PrintRight(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
ConversionOperatorType,
|
||||
LocalName,
|
||||
CtorVtableSpecialName,
|
||||
ArrayType
|
||||
ArrayType,
|
||||
}
|
||||
|
||||
public abstract class BaseNode
|
||||
@@ -99,15 +99,15 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void PrintRight(TextWriter writer) {}
|
||||
public virtual void PrintRight(TextWriter writer) { }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringWriter writer = new StringWriter();
|
||||
StringWriter writer = new();
|
||||
|
||||
Print(writer);
|
||||
|
||||
return writer.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class BinaryExpression : BaseNode
|
||||
{
|
||||
private BaseNode _leftPart;
|
||||
private string _name;
|
||||
private BaseNode _rightPart;
|
||||
private readonly BaseNode _leftPart;
|
||||
private readonly string _name;
|
||||
private readonly BaseNode _rightPart;
|
||||
|
||||
public BinaryExpression(BaseNode leftPart, string name, BaseNode rightPart) : base(NodeType.BinaryExpression)
|
||||
{
|
||||
_leftPart = leftPart;
|
||||
_name = name;
|
||||
_leftPart = leftPart;
|
||||
_name = name;
|
||||
_rightPart = rightPart;
|
||||
}
|
||||
|
||||
@@ -38,4 +38,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class BracedExpression : BaseNode
|
||||
{
|
||||
private BaseNode _element;
|
||||
private BaseNode _expression;
|
||||
private bool _isArrayExpression;
|
||||
private readonly BaseNode _element;
|
||||
private readonly BaseNode _expression;
|
||||
private readonly bool _isArrayExpression;
|
||||
|
||||
public BracedExpression(BaseNode element, BaseNode expression, bool isArrayExpression) : base(NodeType.BracedExpression)
|
||||
{
|
||||
_element = element;
|
||||
_expression = expression;
|
||||
_element = element;
|
||||
_expression = expression;
|
||||
_isArrayExpression = isArrayExpression;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class BracedRangeExpression : BaseNode
|
||||
{
|
||||
private BaseNode _firstNode;
|
||||
private BaseNode _lastNode;
|
||||
private BaseNode _expression;
|
||||
private readonly BaseNode _firstNode;
|
||||
private readonly BaseNode _lastNode;
|
||||
private readonly BaseNode _expression;
|
||||
|
||||
public BracedRangeExpression(BaseNode firstNode, BaseNode lastNode, BaseNode expression) : base(NodeType.BracedRangeExpression)
|
||||
{
|
||||
_firstNode = firstNode;
|
||||
_lastNode = lastNode;
|
||||
_firstNode = firstNode;
|
||||
_lastNode = lastNode;
|
||||
_expression = expression;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class CallExpression : NodeArray
|
||||
{
|
||||
private BaseNode _callee;
|
||||
private readonly BaseNode _callee;
|
||||
|
||||
public CallExpression(BaseNode callee, List<BaseNode> nodes) : base(nodes, NodeType.CallExpression)
|
||||
{
|
||||
@@ -21,4 +21,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class CastExpression : BaseNode
|
||||
{
|
||||
private string _kind;
|
||||
private BaseNode _to;
|
||||
private BaseNode _from;
|
||||
private readonly string _kind;
|
||||
private readonly BaseNode _to;
|
||||
private readonly BaseNode _from;
|
||||
|
||||
public CastExpression(string kind, BaseNode to, BaseNode from) : base(NodeType.CastExpression)
|
||||
{
|
||||
_kind = kind;
|
||||
_to = to;
|
||||
_to = to;
|
||||
_from = from;
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ConditionalExpression : BaseNode
|
||||
{
|
||||
private BaseNode _thenNode;
|
||||
private BaseNode _elseNode;
|
||||
private BaseNode _conditionNode;
|
||||
private readonly BaseNode _thenNode;
|
||||
private readonly BaseNode _elseNode;
|
||||
private readonly BaseNode _conditionNode;
|
||||
|
||||
public ConditionalExpression(BaseNode conditionNode, BaseNode thenNode, BaseNode elseNode) : base(NodeType.ConditionalExpression)
|
||||
{
|
||||
_thenNode = thenNode;
|
||||
_thenNode = thenNode;
|
||||
_conditionNode = conditionNode;
|
||||
_elseNode = elseNode;
|
||||
_elseNode = elseNode;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -26,4 +26,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ConversionExpression : BaseNode
|
||||
{
|
||||
private BaseNode _typeNode;
|
||||
private BaseNode _expressions;
|
||||
private readonly BaseNode _typeNode;
|
||||
private readonly BaseNode _expressions;
|
||||
|
||||
public ConversionExpression(BaseNode typeNode, BaseNode expressions) : base(NodeType.ConversionExpression)
|
||||
{
|
||||
_typeNode = typeNode;
|
||||
_typeNode = typeNode;
|
||||
_expressions = expressions;
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_expressions.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
Child.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class CtorDtorNameType : ParentNode
|
||||
{
|
||||
private bool _isDestructor;
|
||||
private readonly bool _isDestructor;
|
||||
|
||||
public CtorDtorNameType(BaseNode name, bool isDestructor) : base(NodeType.CtorDtorNameType, name)
|
||||
{
|
||||
@@ -21,4 +21,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(Child.GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class CtorVtableSpecialName : BaseNode
|
||||
{
|
||||
private BaseNode _firstType;
|
||||
private BaseNode _secondType;
|
||||
private readonly BaseNode _firstType;
|
||||
private readonly BaseNode _secondType;
|
||||
|
||||
public CtorVtableSpecialName(BaseNode firstType, BaseNode secondType) : base(NodeType.CtorVtableSpecialName)
|
||||
{
|
||||
_firstType = firstType;
|
||||
_firstType = firstType;
|
||||
_secondType = secondType;
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_secondType.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class DeleteExpression : ParentNode
|
||||
{
|
||||
private bool _isGlobal;
|
||||
private bool _isArrayExpression;
|
||||
private readonly bool _isGlobal;
|
||||
private readonly bool _isArrayExpression;
|
||||
|
||||
public DeleteExpression(BaseNode child, bool isGlobal, bool isArrayExpression) : base(NodeType.DeleteExpression, child)
|
||||
{
|
||||
_isGlobal = isGlobal;
|
||||
_isGlobal = isGlobal;
|
||||
_isArrayExpression = isArrayExpression;
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
Child.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
Child.PrintLeft(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ElaboratedType : ParentNode
|
||||
{
|
||||
private string _elaborated;
|
||||
private readonly string _elaborated;
|
||||
|
||||
public ElaboratedType(string elaborated, BaseNode type) : base(NodeType.ElaboratedType, type)
|
||||
{
|
||||
@@ -18,4 +18,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
Child.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class EnclosedExpression : BaseNode
|
||||
{
|
||||
private string _prefix;
|
||||
private BaseNode _expression;
|
||||
private string _postfix;
|
||||
private readonly string _prefix;
|
||||
private readonly BaseNode _expression;
|
||||
private readonly string _postfix;
|
||||
|
||||
public EnclosedExpression(string prefix, BaseNode expression, string postfix) : base(NodeType.EnclosedExpression)
|
||||
{
|
||||
_prefix = prefix;
|
||||
_prefix = prefix;
|
||||
_expression = expression;
|
||||
_postfix = postfix;
|
||||
_postfix = postfix;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -22,4 +22,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(_postfix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,21 +4,21 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class EncodedFunction : BaseNode
|
||||
{
|
||||
private BaseNode _name;
|
||||
private BaseNode _params;
|
||||
private BaseNode _cv;
|
||||
private BaseNode _ref;
|
||||
private BaseNode _attrs;
|
||||
private BaseNode _ret;
|
||||
private readonly BaseNode _name;
|
||||
private readonly BaseNode _params;
|
||||
private readonly BaseNode _cv;
|
||||
private readonly BaseNode _ref;
|
||||
private readonly BaseNode _attrs;
|
||||
private readonly BaseNode _ret;
|
||||
|
||||
public EncodedFunction(BaseNode name, BaseNode Params, BaseNode cv, BaseNode Ref, BaseNode attrs, BaseNode ret) : base(NodeType.NameType)
|
||||
{
|
||||
_name = name;
|
||||
_name = name;
|
||||
_params = Params;
|
||||
_cv = cv;
|
||||
_ref = Ref;
|
||||
_attrs = attrs;
|
||||
_ret = ret;
|
||||
_cv = cv;
|
||||
_ref = Ref;
|
||||
_attrs = attrs;
|
||||
_ret = ret;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -45,33 +45,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
public override void PrintRight(TextWriter writer)
|
||||
{
|
||||
writer.Write("(");
|
||||
|
||||
if (_params != null)
|
||||
{
|
||||
_params.Print(writer);
|
||||
}
|
||||
|
||||
_params?.Print(writer);
|
||||
writer.Write(")");
|
||||
|
||||
if (_ret != null)
|
||||
{
|
||||
_ret.PrintRight(writer);
|
||||
}
|
||||
|
||||
if (_cv != null)
|
||||
{
|
||||
_cv.Print(writer);
|
||||
}
|
||||
|
||||
if (_ref != null)
|
||||
{
|
||||
_ref.Print(writer);
|
||||
}
|
||||
|
||||
if (_attrs != null)
|
||||
{
|
||||
_attrs.Print(writer);
|
||||
}
|
||||
_ret?.PrintRight(writer);
|
||||
_cv?.Print(writer);
|
||||
_ref?.Print(writer);
|
||||
_attrs?.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class FoldExpression : BaseNode
|
||||
{
|
||||
private bool _isLeftFold;
|
||||
private string _operatorName;
|
||||
private BaseNode _expression;
|
||||
private BaseNode _initializer;
|
||||
private readonly bool _isLeftFold;
|
||||
private readonly string _operatorName;
|
||||
private readonly BaseNode _expression;
|
||||
private readonly BaseNode _initializer;
|
||||
|
||||
public FoldExpression(bool isLeftFold, string operatorName, BaseNode expression, BaseNode initializer) : base(NodeType.FunctionParameter)
|
||||
{
|
||||
_isLeftFold = isLeftFold;
|
||||
_isLeftFold = isLeftFold;
|
||||
_operatorName = operatorName;
|
||||
_expression = expression;
|
||||
_initializer = initializer;
|
||||
_expression = expression;
|
||||
_initializer = initializer;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -45,4 +45,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
// TODO: Compute inside the Demangler
|
||||
public BaseNode Reference;
|
||||
private int _index;
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly int _index;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
public ForwardTemplateReference(int index) : base(NodeType.ForwardTemplateReference)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class FunctionParameter : BaseNode
|
||||
{
|
||||
private string _number;
|
||||
private readonly string _number;
|
||||
|
||||
public FunctionParameter(string number) : base(NodeType.FunctionParameter)
|
||||
{
|
||||
@@ -21,4 +21,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class FunctionType : BaseNode
|
||||
{
|
||||
private BaseNode _returnType;
|
||||
private BaseNode _params;
|
||||
private BaseNode _cvQualifier;
|
||||
private SimpleReferenceType _referenceQualifier;
|
||||
private BaseNode _exceptionSpec;
|
||||
private readonly BaseNode _returnType;
|
||||
private readonly BaseNode _params;
|
||||
private readonly BaseNode _cvQualifier;
|
||||
private readonly SimpleReferenceType _referenceQualifier;
|
||||
private readonly BaseNode _exceptionSpec;
|
||||
|
||||
public FunctionType(BaseNode returnType, BaseNode Params, BaseNode cvQualifier, SimpleReferenceType referenceQualifier, BaseNode exceptionSpec) : base(NodeType.FunctionType)
|
||||
{
|
||||
_returnType = returnType;
|
||||
_params = Params;
|
||||
_cvQualifier = cvQualifier;
|
||||
_returnType = returnType;
|
||||
_params = Params;
|
||||
_cvQualifier = cvQualifier;
|
||||
_referenceQualifier = referenceQualifier;
|
||||
_exceptionSpec = exceptionSpec;
|
||||
_exceptionSpec = exceptionSpec;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -58,4 +58,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,25 +5,22 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class InitListExpression : BaseNode
|
||||
{
|
||||
private BaseNode _typeNode;
|
||||
private List<BaseNode> _nodes;
|
||||
private readonly BaseNode _typeNode;
|
||||
private readonly List<BaseNode> _nodes;
|
||||
|
||||
public InitListExpression(BaseNode typeNode, List<BaseNode> nodes) : base(NodeType.InitListExpression)
|
||||
{
|
||||
_typeNode = typeNode;
|
||||
_nodes = nodes;
|
||||
_nodes = nodes;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
{
|
||||
if (_typeNode != null)
|
||||
{
|
||||
_typeNode.Print(writer);
|
||||
}
|
||||
_typeNode?.Print(writer);
|
||||
|
||||
writer.Write("{");
|
||||
writer.Write(string.Join<BaseNode>(", ", _nodes.ToArray()));
|
||||
writer.Write("}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class IntegerCastExpression : ParentNode
|
||||
{
|
||||
private string _number;
|
||||
private readonly string _number;
|
||||
|
||||
public IntegerCastExpression(BaseNode type, string number) : base(NodeType.IntegerCastExpression, type)
|
||||
{
|
||||
@@ -19,4 +19,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class IntegerLiteral : BaseNode
|
||||
{
|
||||
private string _literalName;
|
||||
private string _literalValue;
|
||||
private readonly string _literalName;
|
||||
private readonly string _literalValue;
|
||||
|
||||
public IntegerLiteral(string literalName, string literalValue) : base(NodeType.IntegerLiteral)
|
||||
{
|
||||
_literalValue = literalValue;
|
||||
_literalName = literalName;
|
||||
_literalName = literalName;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -39,4 +39,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write("\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class LocalName : BaseNode
|
||||
{
|
||||
private BaseNode _encoding;
|
||||
private BaseNode _entity;
|
||||
private readonly BaseNode _encoding;
|
||||
private readonly BaseNode _entity;
|
||||
|
||||
public LocalName(BaseNode encoding, BaseNode entity) : base(NodeType.LocalName)
|
||||
{
|
||||
_encoding = encoding;
|
||||
_entity = entity;
|
||||
_entity = entity;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -20,4 +20,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_entity.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class MemberExpression : BaseNode
|
||||
{
|
||||
private BaseNode _leftNode;
|
||||
private string _kind;
|
||||
private BaseNode _rightNode;
|
||||
private readonly BaseNode _leftNode;
|
||||
private readonly string _kind;
|
||||
private readonly BaseNode _rightNode;
|
||||
|
||||
public MemberExpression(BaseNode leftNode, string kind, BaseNode rightNode) : base(NodeType.MemberExpression)
|
||||
{
|
||||
_leftNode = leftNode;
|
||||
_kind = kind;
|
||||
_leftNode = leftNode;
|
||||
_kind = kind;
|
||||
_rightNode = rightNode;
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_rightNode.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class NameType : BaseNode
|
||||
{
|
||||
private string _nameValue;
|
||||
private readonly string _nameValue;
|
||||
|
||||
public NameType(string nameValue, NodeType type) : base(type)
|
||||
{
|
||||
@@ -26,4 +26,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(_nameValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class NameTypeWithTemplateArguments : BaseNode
|
||||
{
|
||||
private BaseNode _prev;
|
||||
private BaseNode _templateArgument;
|
||||
private readonly BaseNode _prev;
|
||||
private readonly BaseNode _templateArgument;
|
||||
|
||||
public NameTypeWithTemplateArguments(BaseNode prev, BaseNode templateArgument) : base(NodeType.NameTypeWithTemplateArguments)
|
||||
{
|
||||
_prev = prev;
|
||||
_prev = prev;
|
||||
_templateArgument = templateArgument;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
return _prev.GetName();
|
||||
}
|
||||
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
{
|
||||
_prev.Print(writer);
|
||||
_templateArgument.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class NestedName : ParentNode
|
||||
{
|
||||
private BaseNode _name;
|
||||
private readonly BaseNode _name;
|
||||
|
||||
public NestedName(BaseNode name, BaseNode type) : base(NodeType.NestedName, type)
|
||||
{
|
||||
@@ -23,4 +23,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_name.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class NewExpression : BaseNode
|
||||
{
|
||||
private NodeArray _expressions;
|
||||
private BaseNode _typeNode;
|
||||
private NodeArray _initializers;
|
||||
private readonly NodeArray _expressions;
|
||||
private readonly BaseNode _typeNode;
|
||||
private readonly NodeArray _initializers;
|
||||
|
||||
private bool _isGlobal;
|
||||
private bool _isArrayExpression;
|
||||
private readonly bool _isGlobal;
|
||||
private readonly bool _isArrayExpression;
|
||||
|
||||
public NewExpression(NodeArray expressions, BaseNode typeNode, NodeArray initializers, bool isGlobal, bool isArrayExpression) : base(NodeType.NewExpression)
|
||||
{
|
||||
_expressions = expressions;
|
||||
_typeNode = typeNode;
|
||||
_initializers = initializers;
|
||||
_expressions = expressions;
|
||||
_typeNode = typeNode;
|
||||
_initializers = initializers;
|
||||
|
||||
_isGlobal = isGlobal;
|
||||
_isGlobal = isGlobal;
|
||||
_isArrayExpression = isArrayExpression;
|
||||
}
|
||||
|
||||
@@ -52,4 +52,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(string.Join<BaseNode>(", ", Nodes.ToArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class PackedTemplateParameterExpansion : ParentNode
|
||||
{
|
||||
public PackedTemplateParameterExpansion(BaseNode child) : base(NodeType.PackedTemplateParameterExpansion, child) {}
|
||||
public PackedTemplateParameterExpansion(BaseNode child) : base(NodeType.PackedTemplateParameterExpansion, child) { }
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
{
|
||||
if (Child is PackedTemplateParameter)
|
||||
if (Child is PackedTemplateParameter parameter)
|
||||
{
|
||||
if (((PackedTemplateParameter)Child).Nodes.Count != 0)
|
||||
if (parameter.Nodes.Count != 0)
|
||||
{
|
||||
Child.Print(writer);
|
||||
parameter.Print(writer);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -21,4 +21,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
return Child.GetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class PointerType : BaseNode
|
||||
{
|
||||
private BaseNode _child;
|
||||
private readonly BaseNode _child;
|
||||
|
||||
public PointerType(BaseNode child) : base(NodeType.PointerType)
|
||||
{
|
||||
@@ -42,4 +42,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_child.PrintRight(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class PostfixExpression : ParentNode
|
||||
{
|
||||
private string _operator;
|
||||
private readonly string _operator;
|
||||
|
||||
public PostfixExpression(BaseNode type, string Operator) : base(NodeType.PostfixExpression, type)
|
||||
{
|
||||
@@ -19,4 +19,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(_operator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class PostfixQualifiedType : ParentNode
|
||||
{
|
||||
private string _postfixQualifier;
|
||||
private readonly string _postfixQualifier;
|
||||
|
||||
public PostfixQualifiedType(string postfixQualifier, BaseNode type) : base(NodeType.PostfixQualifiedType, type)
|
||||
{
|
||||
@@ -17,4 +17,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(_postfixQualifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class PrefixExpression : ParentNode
|
||||
{
|
||||
private string _prefix;
|
||||
private readonly string _prefix;
|
||||
|
||||
public PrefixExpression(string prefix, BaseNode child) : base(NodeType.PrefixExpression, child)
|
||||
{
|
||||
@@ -19,4 +19,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
writer.Write(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class QualifiedName : BaseNode
|
||||
{
|
||||
private BaseNode _qualifier;
|
||||
private BaseNode _name;
|
||||
private readonly BaseNode _qualifier;
|
||||
private readonly BaseNode _name;
|
||||
|
||||
public QualifiedName(BaseNode qualifier, BaseNode name) : base(NodeType.QualifiedName)
|
||||
{
|
||||
_qualifier = qualifier;
|
||||
_name = name;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -20,4 +20,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_name.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
None,
|
||||
Const,
|
||||
Volatile,
|
||||
Restricted = 4
|
||||
Restricted = 4,
|
||||
}
|
||||
|
||||
public enum Reference
|
||||
{
|
||||
None,
|
||||
RValue,
|
||||
LValue
|
||||
LValue,
|
||||
}
|
||||
|
||||
public class CvType : ParentNode
|
||||
@@ -46,10 +46,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintLeft(writer);
|
||||
}
|
||||
Child?.PrintLeft(writer);
|
||||
|
||||
PrintQualifier(writer);
|
||||
}
|
||||
@@ -61,10 +58,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
|
||||
public override void PrintRight(TextWriter writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintRight(writer);
|
||||
}
|
||||
Child?.PrintRight(writer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +105,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
|
||||
public override void PrintRight(TextWriter writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintRight(writer);
|
||||
}
|
||||
Child?.PrintRight(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ReferenceType : BaseNode
|
||||
{
|
||||
private string _reference;
|
||||
private BaseNode _child;
|
||||
private readonly string _reference;
|
||||
private readonly BaseNode _child;
|
||||
|
||||
public ReferenceType(string reference, BaseNode child) : base(NodeType.ReferenceType)
|
||||
{
|
||||
_reference = reference;
|
||||
_child = child;
|
||||
_child = child;
|
||||
}
|
||||
|
||||
public override bool HasRightPart()
|
||||
@@ -44,4 +44,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_child.PrintRight(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class SpecialName : ParentNode
|
||||
{
|
||||
private string _specialValue;
|
||||
private readonly string _specialValue;
|
||||
|
||||
public SpecialName(string specialValue, BaseNode type) : base(NodeType.SpecialName, type)
|
||||
{
|
||||
@@ -17,4 +17,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
Child.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
IOStream
|
||||
}
|
||||
|
||||
private SpecialType _specialSubstitutionKey;
|
||||
private readonly SpecialType _specialSubstitutionKey;
|
||||
|
||||
public SpecialSubstitution(SpecialType specialSubstitutionKey) : base(NodeType.SpecialSubstitution)
|
||||
{
|
||||
@@ -54,23 +54,16 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
|
||||
private string GetExtendedName()
|
||||
{
|
||||
switch (_specialSubstitutionKey)
|
||||
return _specialSubstitutionKey switch
|
||||
{
|
||||
case SpecialType.Allocator:
|
||||
return "std::allocator";
|
||||
case SpecialType.BasicString:
|
||||
return "std::basic_string";
|
||||
case SpecialType.String:
|
||||
return "std::basic_string<char, std::char_traits<char>, std::allocator<char> >";
|
||||
case SpecialType.IStream:
|
||||
return "std::basic_istream<char, std::char_traits<char> >";
|
||||
case SpecialType.OStream:
|
||||
return "std::basic_ostream<char, std::char_traits<char> >";
|
||||
case SpecialType.IOStream:
|
||||
return "std::basic_iostream<char, std::char_traits<char> >";
|
||||
}
|
||||
|
||||
return null;
|
||||
SpecialType.Allocator => "std::allocator",
|
||||
SpecialType.BasicString => "std::basic_string",
|
||||
SpecialType.String => "std::basic_string<char, std::char_traits<char>, std::allocator<char> >",
|
||||
SpecialType.IStream => "std::basic_istream<char, std::char_traits<char> >",
|
||||
SpecialType.OStream => "std::basic_ostream<char, std::char_traits<char> >",
|
||||
SpecialType.IOStream => "std::basic_iostream<char, std::char_traits<char> >",
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
@@ -86,4 +79,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
|
||||
public override void PrintLeft(TextWriter writer)
|
||||
{
|
||||
string Params = string.Join<BaseNode>(", ", Nodes.ToArray());
|
||||
string paramsString = string.Join<BaseNode>(", ", Nodes.ToArray());
|
||||
|
||||
writer.Write("<");
|
||||
|
||||
writer.Write(Params);
|
||||
writer.Write(paramsString);
|
||||
|
||||
if (Params.EndsWith('>'))
|
||||
if (paramsString.EndsWith('>'))
|
||||
{
|
||||
writer.Write(" ");
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public class ThrowExpression : BaseNode
|
||||
{
|
||||
private BaseNode _expression;
|
||||
private readonly BaseNode _expression;
|
||||
|
||||
public ThrowExpression(BaseNode expression) : base(NodeType.ThrowExpression)
|
||||
{
|
||||
@@ -17,4 +17,4 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
_expression.Print(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,25 +8,25 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
{
|
||||
class Demangler
|
||||
{
|
||||
private static readonly string Base36 = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
private List<BaseNode> _substitutionList = new List<BaseNode>();
|
||||
private List<BaseNode> _templateParamList = new List<BaseNode>();
|
||||
private static readonly string _base36 = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
private readonly List<BaseNode> _substitutionList = new();
|
||||
private List<BaseNode> _templateParamList = new();
|
||||
|
||||
private List<ForwardTemplateReference> _forwardTemplateReferenceList = new List<ForwardTemplateReference>();
|
||||
private readonly List<ForwardTemplateReference> _forwardTemplateReferenceList = new();
|
||||
|
||||
public string Mangled { get; private set; }
|
||||
|
||||
private int _position;
|
||||
private int _length;
|
||||
private readonly int _length;
|
||||
|
||||
private bool _canForwardTemplateReference;
|
||||
private bool _canParseTemplateArgs;
|
||||
|
||||
public Demangler(string mangled)
|
||||
{
|
||||
Mangled = mangled;
|
||||
_position = 0;
|
||||
_length = mangled.Length;
|
||||
Mangled = mangled;
|
||||
_position = 0;
|
||||
_length = mangled.Length;
|
||||
_canParseTemplateArgs = true;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
for (int i = 0; i < reversedEncoded.Length; i++)
|
||||
{
|
||||
int value = Base36.IndexOf(reversedEncoded[i]);
|
||||
int value = _base36.IndexOf(reversedEncoded[i]);
|
||||
if (value == -1)
|
||||
{
|
||||
return -1;
|
||||
@@ -101,8 +101,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
private int ParseSeqId()
|
||||
{
|
||||
ReadOnlySpan<char> part = Mangled.AsSpan(_position);
|
||||
int seqIdLen = 0;
|
||||
ReadOnlySpan<char> part = Mangled.AsSpan(_position);
|
||||
int seqIdLen = 0;
|
||||
|
||||
for (; seqIdLen < part.Length; seqIdLen++)
|
||||
{
|
||||
@@ -274,7 +274,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
}
|
||||
else if (ConsumeIf("Dw"))
|
||||
{
|
||||
List<BaseNode> types = new List<BaseNode>();
|
||||
List<BaseNode> types = new();
|
||||
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
@@ -308,7 +308,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
}
|
||||
|
||||
Reference referenceQualifier = Reference.None;
|
||||
List<BaseNode> Params = new List<BaseNode>();
|
||||
List<BaseNode> paramsList = new();
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -339,10 +339,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
}
|
||||
|
||||
Params.Add(type);
|
||||
paramsList.Add(type);
|
||||
}
|
||||
|
||||
return new FunctionType(returnType, new NodeArray(Params), new CvType(cvQualifiers, null), new SimpleReferenceType(referenceQualifier, null), exceptionSpec);
|
||||
return new FunctionType(returnType, new NodeArray(paramsList), new CvType(cvQualifiers, null), new SimpleReferenceType(referenceQualifier, null), exceptionSpec);
|
||||
}
|
||||
|
||||
// <array-type> ::= A <positive dimension number> _ <element type>
|
||||
@@ -416,12 +416,9 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
private BaseNode ParseType(NameParserContext context = null)
|
||||
{
|
||||
// Temporary context
|
||||
if (context == null)
|
||||
{
|
||||
context = new NameParserContext();
|
||||
}
|
||||
context ??= new NameParserContext();
|
||||
|
||||
BaseNode result = null;
|
||||
BaseNode result;
|
||||
switch (Peek())
|
||||
{
|
||||
case 'r':
|
||||
@@ -545,8 +542,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
case 'h':
|
||||
_position += 2;
|
||||
// FIXME: GNU c++flit returns this but that is not what is supposed to be returned.
|
||||
return new NameType("half");
|
||||
// return new NameType("decimal16");
|
||||
return new NameType("half"); // return new NameType("decimal16");
|
||||
case 'i':
|
||||
_position += 2;
|
||||
return new NameType("char32_t");
|
||||
@@ -559,8 +555,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
case 'n':
|
||||
_position += 2;
|
||||
// FIXME: GNU c++flit returns this but that is not what is supposed to be returned.
|
||||
return new NameType("decltype(nullptr)");
|
||||
// return new NameType("std::nullptr_t");
|
||||
return new NameType("decltype(nullptr)"); // return new NameType("std::nullptr_t");
|
||||
case 't':
|
||||
case 'T':
|
||||
_position += 2;
|
||||
@@ -882,7 +877,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return new SimpleReferenceType(result, null);
|
||||
}
|
||||
|
||||
private BaseNode CreateNameNode(BaseNode prev, BaseNode name, NameParserContext context)
|
||||
private static BaseNode CreateNameNode(BaseNode prev, BaseNode name, NameParserContext context)
|
||||
{
|
||||
BaseNode result = name;
|
||||
if (prev != null)
|
||||
@@ -900,8 +895,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
private int ParsePositiveNumber()
|
||||
{
|
||||
ReadOnlySpan<char> part = Mangled.AsSpan(_position);
|
||||
int numberLength = 0;
|
||||
ReadOnlySpan<char> part = Mangled.AsSpan(_position);
|
||||
int numberLength = 0;
|
||||
|
||||
for (; numberLength < part.Length; numberLength++)
|
||||
{
|
||||
@@ -933,8 +928,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
}
|
||||
|
||||
ReadOnlySpan<char> part = Mangled.AsSpan(_position);
|
||||
int numberLength = 0;
|
||||
ReadOnlySpan<char> part = Mangled.AsSpan(_position);
|
||||
int numberLength = 0;
|
||||
|
||||
for (; numberLength < part.Length; numberLength++)
|
||||
{
|
||||
@@ -1057,15 +1052,15 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
case 'v':
|
||||
_position += 2;
|
||||
|
||||
bool canParseTemplateArgsBackup = _canParseTemplateArgs;
|
||||
bool canParseTemplateArgsBackup = _canParseTemplateArgs;
|
||||
bool canForwardTemplateReferenceBackup = _canForwardTemplateReference;
|
||||
|
||||
_canParseTemplateArgs = false;
|
||||
_canParseTemplateArgs = false;
|
||||
_canForwardTemplateReference = canForwardTemplateReferenceBackup || context != null;
|
||||
|
||||
BaseNode type = ParseType();
|
||||
|
||||
_canParseTemplateArgs = canParseTemplateArgsBackup;
|
||||
_canParseTemplateArgs = canParseTemplateArgsBackup;
|
||||
_canForwardTemplateReference = canForwardTemplateReferenceBackup;
|
||||
|
||||
if (type == null)
|
||||
@@ -1324,17 +1319,17 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
// ::= C3 # complete object allocating constructor
|
||||
// ::= D0 # deleting destructor
|
||||
// ::= D1 # complete object destructor
|
||||
// ::= D2 # base object destructor
|
||||
// ::= D2 # base object destructor
|
||||
private BaseNode ParseCtorDtorName(NameParserContext context, BaseNode prev)
|
||||
{
|
||||
if (prev.Type == NodeType.SpecialSubstitution && prev is SpecialSubstitution)
|
||||
if (prev.Type == NodeType.SpecialSubstitution && prev is SpecialSubstitution substitution)
|
||||
{
|
||||
((SpecialSubstitution)prev).SetExtended();
|
||||
substitution.SetExtended();
|
||||
}
|
||||
|
||||
if (ConsumeIf("C"))
|
||||
{
|
||||
bool isInherited = ConsumeIf("I");
|
||||
bool isInherited = ConsumeIf("I");
|
||||
|
||||
char ctorDtorType = Peek();
|
||||
if (ctorDtorType != '1' && ctorDtorType != '2' && ctorDtorType != '3')
|
||||
@@ -1434,9 +1429,9 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
}
|
||||
|
||||
char foldKind = Peek();
|
||||
char foldKind = Peek();
|
||||
bool hasInitializer = foldKind == 'L' || foldKind == 'R';
|
||||
bool isLeftFold = foldKind == 'l' || foldKind == 'L';
|
||||
bool isLeftFold = foldKind == 'l' || foldKind == 'L';
|
||||
|
||||
if (!isLeftFold && !(foldKind == 'r' || foldKind == 'R'))
|
||||
{
|
||||
@@ -1445,7 +1440,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
_position++;
|
||||
|
||||
string operatorName = null;
|
||||
string operatorName;
|
||||
|
||||
switch (PeekString(0, 2))
|
||||
{
|
||||
@@ -1567,9 +1562,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
if (isLeftFold && initializer != null)
|
||||
{
|
||||
BaseNode temp = expression;
|
||||
expression = initializer;
|
||||
initializer = temp;
|
||||
(initializer, expression) = (expression, initializer);
|
||||
}
|
||||
|
||||
return new FoldExpression(isLeftFold, operatorName, new PackedTemplateParameterExpansion(expression), initializer);
|
||||
@@ -1586,16 +1579,16 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
}
|
||||
|
||||
bool canParseTemplateArgsBackup = _canParseTemplateArgs;
|
||||
_canParseTemplateArgs = false;
|
||||
BaseNode type = ParseType();
|
||||
_canParseTemplateArgs = canParseTemplateArgsBackup;
|
||||
_canParseTemplateArgs = false;
|
||||
BaseNode type = ParseType();
|
||||
_canParseTemplateArgs = canParseTemplateArgsBackup;
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<BaseNode> expressions = new List<BaseNode>();
|
||||
List<BaseNode> expressions = new();
|
||||
if (ConsumeIf("_"))
|
||||
{
|
||||
while (!ConsumeIf("E"))
|
||||
@@ -1730,15 +1723,15 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
private BaseNode ParseNewExpression()
|
||||
{
|
||||
bool isGlobal = ConsumeIf("gs");
|
||||
bool isArray = Peek(1) == 'a';
|
||||
bool isArray = Peek(1) == 'a';
|
||||
|
||||
if (!ConsumeIf("nw") || !ConsumeIf("na"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<BaseNode> expressions = new List<BaseNode>();
|
||||
List<BaseNode> initializers = new List<BaseNode>();
|
||||
List<BaseNode> expressions = new();
|
||||
List<BaseNode> initializers = new();
|
||||
|
||||
while (!ConsumeIf("_"))
|
||||
{
|
||||
@@ -1824,7 +1817,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
private BaseNode ParseExpression()
|
||||
{
|
||||
bool isGlobal = ConsumeIf("gs");
|
||||
BaseNode expression = null;
|
||||
BaseNode expression;
|
||||
if (Count() < 2)
|
||||
{
|
||||
return null;
|
||||
@@ -1906,7 +1899,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
}
|
||||
|
||||
List<BaseNode> names = new List<BaseNode>();
|
||||
List<BaseNode> names = new();
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
expression = ParseExpression();
|
||||
@@ -1929,8 +1922,8 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
}
|
||||
return null;
|
||||
case 'd':
|
||||
BaseNode leftNode = null;
|
||||
BaseNode rightNode = null;
|
||||
BaseNode leftNode;
|
||||
BaseNode rightNode;
|
||||
switch (Peek(1))
|
||||
{
|
||||
case 'a':
|
||||
@@ -2055,7 +2048,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
case 'l':
|
||||
_position += 2;
|
||||
|
||||
List<BaseNode> bracedExpressions = new List<BaseNode>();
|
||||
List<BaseNode> bracedExpressions = new();
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
expression = ParseBracedExpression();
|
||||
@@ -2310,7 +2303,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return new EnclosedExpression("sizeof (", expression, ")");
|
||||
case 'Z':
|
||||
_position += 2;
|
||||
BaseNode sizeofParamNode = null;
|
||||
BaseNode sizeofParamNode;
|
||||
switch (Peek())
|
||||
{
|
||||
case 'T':
|
||||
@@ -2334,7 +2327,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
case 'P':
|
||||
_position += 2;
|
||||
List<BaseNode> arguments = new List<BaseNode>();
|
||||
List<BaseNode> arguments = new();
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
BaseNode argument = ParseTemplateArgument();
|
||||
@@ -2375,7 +2368,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
}
|
||||
|
||||
List<BaseNode> bracedExpressions = new List<BaseNode>();
|
||||
List<BaseNode> bracedExpressions = new();
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
expression = ParseBracedExpression();
|
||||
@@ -2582,7 +2575,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
if (_canForwardTemplateReference)
|
||||
{
|
||||
ForwardTemplateReference forwardTemplateReference = new ForwardTemplateReference(index);
|
||||
ForwardTemplateReference forwardTemplateReference = new(index);
|
||||
_forwardTemplateReferenceList.Add(forwardTemplateReference);
|
||||
return forwardTemplateReference;
|
||||
}
|
||||
@@ -2607,12 +2600,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
_templateParamList.Clear();
|
||||
}
|
||||
|
||||
List<BaseNode> args = new List<BaseNode>();
|
||||
List<BaseNode> args = new();
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
if (hasContext)
|
||||
{
|
||||
List<BaseNode> templateParamListTemp = new List<BaseNode>(_templateParamList);
|
||||
List<BaseNode> templateParamListTemp = new(_templateParamList);
|
||||
BaseNode templateArgument = ParseTemplateArgument();
|
||||
_templateParamList = templateParamListTemp;
|
||||
if (templateArgument == null)
|
||||
@@ -2666,7 +2659,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
// J <template-arg>* E
|
||||
case 'J':
|
||||
_position++;
|
||||
List<BaseNode> templateArguments = new List<BaseNode>();
|
||||
List<BaseNode> templateArguments = new();
|
||||
while (!ConsumeIf("E"))
|
||||
{
|
||||
BaseNode templateArgument = ParseTemplateArgument();
|
||||
@@ -2976,7 +2969,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
}
|
||||
|
||||
BaseNode result = null;
|
||||
CvType cv = new CvType(ParseCvQualifiers(), null);
|
||||
CvType cv = new(ParseCvQualifiers(), null);
|
||||
if (context != null)
|
||||
{
|
||||
context.Cv = cv;
|
||||
@@ -3269,7 +3262,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
// ::= <special-name>
|
||||
private BaseNode ParseEncoding()
|
||||
{
|
||||
NameParserContext context = new NameParserContext();
|
||||
NameParserContext context = new();
|
||||
if (Peek() == 'T' || (Peek() == 'G' && Peek(1) == 'V'))
|
||||
{
|
||||
return ParseSpecialName(context);
|
||||
@@ -3305,7 +3298,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return new EncodedFunction(name, null, context.Cv, context.Ref, null, returnType);
|
||||
}
|
||||
|
||||
List<BaseNode> Params = new List<BaseNode>();
|
||||
List<BaseNode> paramsList = new();
|
||||
|
||||
// backup because that can be destroyed by parseType
|
||||
CvType cv = context.Cv;
|
||||
@@ -3319,10 +3312,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
return null;
|
||||
}
|
||||
|
||||
Params.Add(param);
|
||||
paramsList.Add(param);
|
||||
}
|
||||
|
||||
return new EncodedFunction(name, new NodeArray(Params), cv, Ref, null, returnType);
|
||||
return new EncodedFunction(name, new NodeArray(paramsList), cv, Ref, null, returnType);
|
||||
}
|
||||
|
||||
// <mangled-name> ::= _Z <encoding>
|
||||
@@ -3351,12 +3344,12 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
||||
|
||||
public static string Parse(string originalMangled)
|
||||
{
|
||||
Demangler instance = new Demangler(originalMangled);
|
||||
BaseNode resNode = instance.Parse();
|
||||
Demangler instance = new(originalMangled);
|
||||
BaseNode resNode = instance.Parse();
|
||||
|
||||
if (resNode != null)
|
||||
{
|
||||
StringWriter writer = new StringWriter();
|
||||
StringWriter writer = new();
|
||||
resNode.Print(writer);
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user