Merge pull request #963 from kebby/master
[mono.git] / mcs / class / corlib / System.Reflection.Emit / LocalBuilder.cs
1
2 //
3 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining
6 // a copy of this software and associated documentation files (the
7 // "Software"), to deal in the Software without restriction, including
8 // without limitation the rights to use, copy, modify, merge, publish,
9 // distribute, sublicense, and/or sell copies of the Software, and to
10 // permit persons to whom the Software is furnished to do so, subject to
11 // the following conditions:
12 // 
13 // The above copyright notice and this permission notice shall be
14 // included in all copies or substantial portions of the Software.
15 // 
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24
25 //
26 // System.Reflection.Emit/LocalBuilder.cs
27 //
28 // Authors:
29 //   Paolo Molaro (lupus@ximian.com)
30 //   Martin Baulig (martin@gnome.org)
31 //   Miguel de Icaza (miguel@ximian.com)
32 //
33 // (C) 2001, 2002 Ximian, Inc.  http://www.ximian.com
34 //
35
36 #if !FULL_AOT_RUNTIME
37 using System;
38 using System.Reflection;
39 using System.Reflection.Emit;
40 using System.Globalization;
41 using System.Runtime.CompilerServices;
42 using System.Runtime.InteropServices;
43 using System.Diagnostics.SymbolStore;
44
45 namespace System.Reflection.Emit {
46         [ComVisible (true)]
47         [ComDefaultInterface (typeof (_LocalBuilder))]
48         [ClassInterface (ClassInterfaceType.None)]
49         [StructLayout (LayoutKind.Sequential)]
50         public sealed class LocalBuilder : LocalVariableInfo, _LocalBuilder {
51
52                 // Some fields are already defined in LocalVariableInfo
53                 #region Sync with reflection.h
54                 private string name;
55                 #endregion
56                 
57                 internal ILGenerator ilgen;
58                 int startOffset;
59                 int endOffset;
60
61                 internal LocalBuilder (Type t, ILGenerator ilgen)
62                 {
63                         this.type = t;
64                         this.ilgen = ilgen;
65                 }
66
67                 public void SetLocalSymInfo (string name, int startOffset, int endOffset)
68                 {
69                         this.name = name;
70                         this.startOffset = startOffset;
71                         this.endOffset = endOffset;
72                 }
73
74                 public void SetLocalSymInfo (string name)
75                 {
76                         SetLocalSymInfo (name, 0, 0);
77                 }
78
79                 public override Type LocalType
80                 {
81                         get {
82                                 return type;
83                         }
84                 }
85
86                 public override bool IsPinned
87                 {
88                         get {
89                                 return is_pinned;
90                         }
91                 }
92
93                 public override int LocalIndex
94                 {
95                         get {
96                                 return position;
97                         }
98                 }
99
100                 internal string Name {
101                         get { return name; }
102                 }
103                 
104                 internal int StartOffset {
105                         get { return startOffset; }
106                 }
107                 
108                 internal int EndOffset {
109                         get { return endOffset; }
110                 }
111
112                 void _LocalBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
113                 {
114                         throw new NotImplementedException ();
115                 }
116
117                 void _LocalBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
118                 {
119                         throw new NotImplementedException ();
120                 }
121
122                 void _LocalBuilder.GetTypeInfoCount (out uint pcTInfo)
123                 {
124                         throw new NotImplementedException ();
125                 }
126
127                 void _LocalBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
128                 {
129                         throw new NotImplementedException ();
130                 }
131         }
132 }
133 #endif