From b3b52875842871d69a4bbfd18d530d88ac7fc70d Mon Sep 17 00:00:00 2001 From: jbevain Date: Fri, 26 Feb 2010 16:10:38 +0000 Subject: [PATCH] 2010-02-13 Jb Evain * Mono.Cecil/ReflectionReader.cs: don't cache everything that is context dependent. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@152553 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/Mono.Cecil/ChangeLog | 5 +++++ class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/class/Mono.Cecil/ChangeLog b/class/Mono.Cecil/ChangeLog index 7817e304de..3e0534b497 100644 --- a/class/Mono.Cecil/ChangeLog +++ b/class/Mono.Cecil/ChangeLog @@ -1,5 +1,10 @@ 2010-02-13 Jb Evain + * Mono.Cecil/ReflectionReader.cs: don't cache everything + that is context dependent. + +2010-02-13 Jb Evain + * Mono.Cecil/MethodReturnType.cs: avoid creating an inner parameter if not necessary. diff --git a/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs b/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs index fe6d3c1946..07dd338554 100644 --- a/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs +++ b/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs @@ -148,8 +148,8 @@ namespace Mono.Cecil { TypeSpecRow tsRow = tsTable [index]; TypeSpec ts = m_sigReader.GetTypeSpec (tsRow.Signature); - // don't cache generic instances - if (ts.Type.ElementType == ElementType.GenericInst) + // don't cache context dependent generic stuff + if (IsGenericTypeSpec (ts.Type.ElementType)) return CreateTypeSpecFromSig (ts, index, context); TypeReference tspec = m_typeSpecs [index]; @@ -162,6 +162,13 @@ namespace Mono.Cecil { return tspec; } + static bool IsGenericTypeSpec (ElementType etype) + { + return etype == ElementType.GenericInst + || etype == ElementType.Var + || etype == ElementType.MVar; + } + TypeReference CreateTypeSpecFromSig (TypeSpec ts, int index, GenericContext context) { TypeReference tspec = GetTypeRefFromSig (ts.Type, context); -- 2.11.4.GIT