mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-07 16:30:35 +00:00
Added additional identifier constraints.
This commit is contained in:
parent
879da06b29
commit
dd0de0a75b
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Mono.Cecil.Cil;
|
||||||
|
|
||||||
namespace OpenTK.Rewrite
|
namespace OpenTK.Rewrite
|
||||||
{
|
{
|
||||||
|
@ -8,36 +9,48 @@ namespace OpenTK.Rewrite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GeneratedVariableIdentifier
|
public class GeneratedVariableIdentifier
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="MethodBody"/> which the variable is in.
|
||||||
|
/// </summary>
|
||||||
|
public MethodBody Body { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="VariableDefinition"/> which the variable idetifier maps to.
|
||||||
|
/// </summary>
|
||||||
|
public VariableDefinition Definition { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the generated variable.
|
/// The name of the generated variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The index of the generated variable in its method.
|
|
||||||
/// </summary>
|
|
||||||
public int Index { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="GeneratedVariableIdentifier"/> class.
|
/// Initializes a new instance of the <see cref="GeneratedVariableIdentifier"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="body">The method body which the variable is in.</param>
|
||||||
/// <param name="name">The name of the generated variable.</param>
|
/// <param name="name">The name of the generated variable.</param>
|
||||||
/// <param name="index">The index of the generated variable in its method.</param>
|
/// <param name="index">The index of the generated variable in its method.</param>
|
||||||
/// <exception cref="ArgumentException"></exception>
|
/// <exception cref="ArgumentException"></exception>
|
||||||
public GeneratedVariableIdentifier(string name, int index)
|
public GeneratedVariableIdentifier(MethodBody body, VariableDefinition definition, string name)
|
||||||
{
|
{
|
||||||
|
if (body == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("The body argument cannot be null.", nameof(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (definition == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("The definition argument cannot be null.", nameof(body));
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("The name argument cannot be null or empty", nameof(name));
|
throw new ArgumentException("The name argument cannot be null or empty", nameof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0)
|
this.Body = body;
|
||||||
{
|
this.Definition = definition;
|
||||||
throw new ArgumentException("The index must be greater than zero.", nameof(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Name = name;
|
this.Name = name;
|
||||||
this.Index = index;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue