/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; using dnlib.DotNet; namespace dnSpy.Contracts.Debugger.DotNet.Code { /// /// Method local info /// public readonly struct DbgLocal { /// /// Gets the local index or < 0 if it's not in the metadata /// public int Index { get; } /// /// Gets the name of the local /// public string Name { get; } /// /// Gets the hoisted field or null if it's not a hoisted local /// public FieldDef? HoistedField { get; } /// /// Gets the flags /// public DbgLocalFlags Flags { get; } /// /// true if this is a decompiler generated local /// public bool IsDecompilerGenerated => (Flags & DbgLocalFlags.DecompilerGenerated) != 0; /// /// true if this is a debugger hidden local /// public bool IsDebuggerHidden => (Flags & DbgLocalFlags.DebuggerHidden) != 0; /// /// Constructor /// /// Index of local or < 0 if it's not in the metadata /// Name of the local /// Hoisted field or null if it's not a hoisted local/parameter /// Local flags public DbgLocal(int index, string name, FieldDef? hoistedField, DbgLocalFlags flags) { Index = index; Name = name ?? throw new ArgumentNullException(nameof(name)); HoistedField = hoistedField; Flags = flags; } } /// /// Locals flags /// [Flags] public enum DbgLocalFlags : uint { /// /// No bit is set /// None = 0, /// /// Decompiler generated local /// DecompilerGenerated = 0x00000001, /// /// Debugger hidden local /// DebuggerHidden = 0x00000002, } }