Welcome to mirror list, hosted at ThFree Co, Russian Federation.

VariableReference.cs « Mono.Cecil.Cil - github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a19216dc8e5ad485ce57406da0e1eb1fb76138d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Author:
//   Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// Licensed under the MIT/X11 license.
//

namespace Mono.Cecil.Cil {

	public abstract class VariableReference {

		string name;
		internal int index = -1;
		protected TypeReference variable_type;

		public string Name {
			get { return name; }
			set { name = value; }
		}

		public TypeReference VariableType {
			get { return variable_type; }
			set { variable_type = value; }
		}

		public int Index {
			get { return index; }
		}

		internal VariableReference (TypeReference variable_type)
			: this (string.Empty, variable_type)
		{
		}

		internal VariableReference (string name, TypeReference variable_type)
		{
			this.name = name;
			this.variable_type = variable_type;
		}

		public abstract VariableDefinition Resolve ();

		public override string ToString ()
		{
			if (!string.IsNullOrEmpty (name))
				return name;

			if (index >= 0)
				return "V_" + index;

			return string.Empty;
		}
	}
}