From: Jarl Gullberg Date: Mon, 29 May 2017 17:47:00 +0000 (+0200) Subject: Added additional identifier constraints. X-Git-Tag: v3.0.0~109^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd0de0a75bda6d6e8bae3a5c7f7dbab49865e6f9;p=platform%2Fcore%2Fcsapi%2Fopentk.git Added additional identifier constraints. --- diff --git a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs index d9cef06..aa89acf 100644 --- a/src/Generator.Rewrite/GeneratedVariableIdentifier.cs +++ b/src/Generator.Rewrite/GeneratedVariableIdentifier.cs @@ -1,4 +1,5 @@ using System; +using Mono.Cecil.Cil; namespace OpenTK.Rewrite { @@ -9,35 +10,47 @@ namespace OpenTK.Rewrite public class GeneratedVariableIdentifier { /// - /// The name of the generated variable. + /// The which the variable is in. /// - public string Name { get; } + public MethodBody Body { get; } /// - /// The index of the generated variable in its method. + /// The which the variable idetifier maps to. + /// + public VariableDefinition Definition { get; } + + /// + /// The name of the generated variable. /// - public int Index { get; } + public string Name { get; } /// /// Initializes a new instance of the class. /// + /// The method body which the variable is in. /// The name of the generated variable. /// The index of the generated variable in its method. /// - public GeneratedVariableIdentifier(string name, int index) + public GeneratedVariableIdentifier(MethodBody body, VariableDefinition definition, string name) { - if (string.IsNullOrEmpty(name)) + if (body == null) { - throw new ArgumentException("The name argument cannot be null or empty", nameof(name)); + throw new ArgumentException("The body argument cannot be null.", nameof(body)); } - if (index < 0) + if (definition == null) { - throw new ArgumentException("The index must be greater than zero.", nameof(index)); + throw new ArgumentException("The definition argument cannot be null.", nameof(body)); } - + + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("The name argument cannot be null or empty", nameof(name)); + } + + this.Body = body; + this.Definition = definition; this.Name = name; - this.Index = index; } } } \ No newline at end of file