/*
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.Decompiler {
///
/// A local or parameter present in decompiled code
///
public interface ISourceVariable {
///
/// Gets the real local or parameter or null if it's a decompiler generated variable
///
IVariable? Variable { get; }
///
/// true if this is a local
///
bool IsLocal { get; }
///
/// true if this is a parameter
///
bool IsParameter { get; }
///
/// Gets the name of the variable the decompiler used. It could be different from the real name if the decompiler renamed it.
///
string Name { get; }
///
/// Gets the type of the variable
///
TypeSig Type { get; }
///
/// Gets the hoisted field or null if it's not a hoisted local/parameter
///
FieldDef? HoistedField { get; }
///
/// Gets the flags
///
SourceVariableFlags Flags { get; }
///
/// true if this is a decompiler generated variable
///
bool IsDecompilerGenerated { get; }
}
///
/// flags
///
[Flags]
public enum SourceVariableFlags {
///
/// No bit is set
///
None = 0,
///
/// Decompiler generated variable
///
DecompilerGenerated = 0x00000001,
///
/// Readonly reference, eg. a 'ref readonly' local
///
ReadOnlyReference = 0x00000002,
}
}