| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- //
- // System.Reflection.Emit/LocalBuilder.cs
- //
- // Authors:
- // Paolo Molaro ([email protected])
- // Martin Baulig ([email protected])
- // Miguel de Icaza ([email protected])
- //
- // (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
- //
- using System;
- using System.Reflection;
- using System.Reflection.Emit;
- using System.Globalization;
- using System.Runtime.CompilerServices;
- using System.Diagnostics.SymbolStore;
- namespace System.Reflection.Emit {
- public sealed class LocalBuilder {
- //
- // These are kept in sync with reflection.h
- //
- #region Sync with reflection.h
- private Type type;
- private string name;
- #endregion
-
- //
- // Order does not matter after here
- //
- private ModuleBuilder module;
- internal uint position;
- internal ILGenerator ilgen;
- internal LocalBuilder (ModuleBuilder m, Type t, ILGenerator ilgen)
- {
- this.module = m;
- this.type = t;
- this.ilgen = ilgen;
- }
- public void SetLocalSymInfo (string lname, int startOffset, int endOffset)
- {
- this.name = lname;
- SignatureHelper sighelper = SignatureHelper.GetLocalVarSigHelper (module);
- sighelper.AddArgument (type);
- byte[] signature = sighelper.GetSignature ();
- module.symbol_writer.DefineLocalVariable (lname, FieldAttributes.Private,
- signature, SymAddressKind.ILOffset,
- (int) position, 0, 0,
- startOffset, endOffset);
- }
- public void SetLocalSymInfo (string lname)
- {
- SetLocalSymInfo (lname, 0, 0);
- }
- public Type LocalType
- {
- get {
- return type;
- }
- }
- }
- }
|