<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\INVOCATION_FLAGS.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\LocalVariableInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdConstant.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdFieldInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdImport.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeConstructorInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeEventInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeFieldInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeLocalVariableInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeMethodInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeModule.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeParameterInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\InvalidFilterCriteriaException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\IReflect.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\IReflectableType.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\LocalVariableInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ManifestResourceInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberFilter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberInfo.cs" />
{
public class LocalVariableInfo
{
- #region Private Data Members
- private RuntimeType m_type;
- private int m_isPinned;
- private int m_localIndex;
- #endregion
-
- #region Constructor
+ public virtual Type LocalType { get { Debug.Fail("type must be set!"); return null; } }
+ public virtual int LocalIndex => 0;
+ public virtual bool IsPinned => false;
protected LocalVariableInfo() { }
- #endregion
-
- #region Object Overrides
public override string ToString()
{
string toString = LocalType.ToString() + " (" + LocalIndex + ")";
return toString;
}
- #endregion
-
- #region Public Members
- public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
- public virtual bool IsPinned { get { return m_isPinned != 0; } }
- public virtual int LocalIndex { get { return m_localIndex; } }
- #endregion
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+
+namespace System.Reflection
+{
+ internal sealed class RuntimeLocalVariableInfo : LocalVariableInfo
+ {
+ private RuntimeType _type;
+ private int _localIndex;
+ private bool _isPinned;
+
+ protected RuntimeLocalVariableInfo() { }
+
+ public override Type LocalType { get { Debug.Assert(_type != null, "type must be set!"); return _type; } }
+ public override int LocalIndex => _localIndex;
+ public override bool IsPinned => _isPinned;
+ }
+}
DEFINE_FIELD_U(m_filterOffset, ExceptionHandlingClause, m_filterOffset)
DEFINE_CLASS(EH_CLAUSE, Reflection, ExceptionHandlingClause)
-DEFINE_CLASS_U(Reflection, LocalVariableInfo, LocalVariableInfo)
-DEFINE_FIELD_U(m_type, LocalVariableInfo, m_type)
-DEFINE_FIELD_U(m_isPinned, LocalVariableInfo, m_bIsPinned)
-DEFINE_FIELD_U(m_localIndex, LocalVariableInfo, m_localIndex)
-DEFINE_CLASS(LOCAL_VARIABLE_INFO, Reflection, LocalVariableInfo)
+DEFINE_CLASS_U(Reflection, RuntimeLocalVariableInfo, RuntimeLocalVariableInfo)
+DEFINE_FIELD_U(_type, RuntimeLocalVariableInfo, _type)
+DEFINE_FIELD_U(_localIndex, RuntimeLocalVariableInfo, _localIndex)
+DEFINE_FIELD_U(_isPinned, RuntimeLocalVariableInfo, _isPinned)
+DEFINE_CLASS(RUNTIME_LOCAL_VARIABLE_INFO, Reflection, RuntimeLocalVariableInfo)
DEFINE_CLASS_U(Reflection, MethodBody, MethodBody)
DEFINE_FIELD_U(m_IL, MethodBody, m_IL)
{
METHODBODYREF MethodBodyObj;
EXCEPTIONHANDLINGCLAUSEREF EHClauseObj;
- LOCALVARIABLEINFOREF LocalVariableInfoObj;
+ RUNTIMELOCALVARIABLEINFOREF RuntimeLocalVariableInfoObj;
U1ARRAYREF U1Array;
BASEARRAYREF TempArray;
REFLECTCLASSBASEREF declaringType;
gc.MethodBodyObj = NULL;
gc.EHClauseObj = NULL;
- gc.LocalVariableInfoObj = NULL;
+ gc.RuntimeLocalVariableInfoObj = NULL;
gc.U1Array = NULL;
gc.TempArray = NULL;
gc.declaringType = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pDeclaringTypeUNSAFE);
MethodTable * pExceptionHandlingClauseMT = MscorlibBinder::GetClass(CLASS__EH_CLAUSE);
TypeHandle thEHClauseArray = ClassLoader::LoadArrayTypeThrowing(TypeHandle(pExceptionHandlingClauseMT), ELEMENT_TYPE_SZARRAY);
- MethodTable * pLocalVariableMT = MscorlibBinder::GetClass(CLASS__LOCAL_VARIABLE_INFO);
+ MethodTable * pLocalVariableMT = MscorlibBinder::GetClass(CLASS__RUNTIME_LOCAL_VARIABLE_INFO);
TypeHandle thLocalVariableArray = ClassLoader::LoadArrayTypeThrowing(TypeHandle(pLocalVariableMT), ELEMENT_TYPE_SZARRAY);
Module* pModule = pMethod->GetModule();
for (INT32 i = 0; i < cLocals; i ++)
{
- gc.LocalVariableInfoObj = (LOCALVARIABLEINFOREF)AllocateObject(pLocalVariableMT);
+ gc.RuntimeLocalVariableInfoObj = (RUNTIMELOCALVARIABLEINFOREF)AllocateObject(pLocalVariableMT);
- gc.LocalVariableInfoObj->m_localIndex = i;
+ gc.RuntimeLocalVariableInfoObj->_localIndex = i;
metaSig.NextArg();
CorElementType eType;
IfFailThrow(metaSig.GetArgProps().PeekElemType(&eType));
if (ELEMENT_TYPE_PINNED == eType)
- gc.LocalVariableInfoObj->m_bIsPinned = TRUE;
+ gc.RuntimeLocalVariableInfoObj->_isPinned = TRUE;
TypeHandle tempType= metaSig.GetArgProps().GetTypeHandleThrowing(pModule, &sigTypeContext);
OBJECTREF refLocalType = tempType.GetManagedClassObject();
- gc.LocalVariableInfoObj->SetType(refLocalType);
- gc.MethodBodyObj->m_localVariables->SetAt(i, (OBJECTREF) gc.LocalVariableInfoObj);
+ gc.RuntimeLocalVariableInfoObj->SetType(refLocalType);
+ gc.MethodBodyObj->m_localVariables->SetAt(i, (OBJECTREF) gc.RuntimeLocalVariableInfoObj);
}
}
else
class ExceptionHandlingClause;
class MethodBody;
-class LocalVariableInfo;
+class RuntimeLocalVariableInfo;
#ifdef USE_CHECKED_OBJECTREFS
typedef REF<ExceptionHandlingClause> EXCEPTIONHANDLINGCLAUSEREF;
typedef REF<MethodBody> METHODBODYREF;
-typedef REF<LocalVariableInfo> LOCALVARIABLEINFOREF;
+typedef REF<RuntimeLocalVariableInfo> RUNTIMELOCALVARIABLEINFOREF;
#else
typedef DPTR(ExceptionHandlingClause) EXCEPTIONHANDLINGCLAUSEREF;
typedef DPTR(MethodBody) METHODBODYREF;
-typedef DPTR(LocalVariableInfo) LOCALVARIABLEINFOREF;
+typedef DPTR(RuntimeLocalVariableInfo) RUNTIMELOCALVARIABLEINFOREF;
#endif
class ExceptionHandlingClause : Object
CLR_BOOL m_initLocals;
};
-class LocalVariableInfo : Object
+class RuntimeLocalVariableInfo : Object
{
private:
// Disallow creation and copy construction of these.
- LocalVariableInfo() { }
- LocalVariableInfo(LocalVariableInfo &r) { }
+ RuntimeLocalVariableInfo() { }
+ RuntimeLocalVariableInfo(RuntimeLocalVariableInfo &r) { }
public:
REFLECTCLASSBASEREF GetType()
{
- return (REFLECTCLASSBASEREF)m_type;
+ return (REFLECTCLASSBASEREF)_type;
}
void SetType(OBJECTREF type)
{
- SetObjectReference(&m_type, type, GetAppDomain());
+ SetObjectReference(&_type, type, GetAppDomain());
}
- OBJECTREF m_type;
- INT32 m_bIsPinned;
- INT32 m_localIndex;
+ OBJECTREF _type;
+ INT32 _localIndex;
+ CLR_BOOL _isPinned;
};
class MdUtf8String {