Author: jbevain
Date: 2007-02-22 17:21:26 -0500 (Thu, 22 Feb 2007)
New Revision: 73343
Modified:
trunk/cecil/lib/Mono.Cecil.Cil/CodeReader.cs
trunk/cecil/lib/Mono.Cecil/LinkedResource.cs
trunk/cecil/lib/Mono.Cecil/ParameterDefinition.cs
trunk/cecil/lib/Mono.Cecil/ReflectionHelper.cs
trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs
trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs
trunk/cecil/lib/Mono.Cecil/StructureWriter.cs
Log:
code hygiene
Modified: trunk/cecil/lib/Mono.Cecil/LinkedResource.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/LinkedResource.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil/LinkedResource.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -4,7 +4,7 @@
// Author:
// Jb Evain ([EMAIL PROTECTED])
//
-// (C) 2005 Jb Evain
+// (C) 2005 - 2007 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -28,8 +28,6 @@
namespace Mono.Cecil {
- using Mono.Cecil.Metadata;
-
public sealed class LinkedResource : Resource {
byte [] m_hash;
Modified: trunk/cecil/lib/Mono.Cecil/ParameterDefinition.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ParameterDefinition.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil/ParameterDefinition.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -4,7 +4,7 @@
// Author:
// Jb Evain ([EMAIL PROTECTED])
//
-// (C) 2005 Jb Evain
+// (C) 2005 - 2007 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -28,10 +28,6 @@
namespace Mono.Cecil {
- using System;
-
- using Mono.Cecil.Metadata;
-
public sealed class ParameterDefinition : ParameterReference,
IHasMarshalSpec,
IMetadataTokenProvider, ICustomAttributeProvider, IHasConstant {
Modified: trunk/cecil/lib/Mono.Cecil/ReflectionHelper.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ReflectionHelper.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil/ReflectionHelper.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -6,6 +6,7 @@
//
// (C) 2005 Jb Evain
// (C) 2006 Evaluant RC S.A.
+// (C) 2007 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -443,14 +444,14 @@
genElemType.GenericArguments.Add (ImportTypeReference (arg, context));
elementType = genElemType;
- }else
+ } else
throw new ReflectionException ("Unknown
element type: {0}", t.GetType ().Name);
}
return elementType;
}
- GenericParameter GetGenericParameter (GenericParameter gp,
ImportContext context)
+ static GenericParameter GetGenericParameter (GenericParameter
gp, ImportContext context)
{
GenericParameter p;
if (gp.Owner is TypeReference)
Modified: trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil/ReflectionReader.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -191,7 +191,7 @@
GetTypeRefFromSig (fs.Type,
nc));
} else {
string name =
m_root.Streams.StringsHeap [mrefRow.Name];
- MethodSig ms = sig as MethodSig;
+ MethodSig ms = (MethodSig) sig;
MethodReference methref = new
MethodReference (
name, ms.HasThis,
ms.ExplicitThis, ms.MethCallConv);
@@ -755,7 +755,7 @@
}
}
- object GetFixedArgValue (CustomAttrib.FixedArg fa)
+ static object GetFixedArgValue (CustomAttrib.FixedArg fa)
{
if (fa.SzArray) {
object [] vals = new object [fa.NumElem];
@@ -1033,7 +1033,7 @@
return type;
}
- void CheckGenericParameters (GenericContext context, VAR v)
+ static void CheckGenericParameters (GenericContext context, VAR
v)
{
for (int i = context.Type.GenericParameters.Count; i <=
v.Index; i++)
context.Type.GenericParameters.Add (new
GenericParameter (i, context.Type));
Modified: trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil/ReflectionWriter.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -52,10 +52,10 @@
string m_asmOutput;
ISymbolWriter m_symbolWriter;
- IList m_typeDefStack;
- IList m_methodStack;
- IList m_fieldStack;
- IList m_genericParamStack;
+ ArrayList m_typeDefStack;
+ ArrayList m_methodStack;
+ ArrayList m_fieldStack;
+ ArrayList m_genericParamStack;
IDictionary m_typeSpecCache;
uint m_methodIndex;
@@ -149,7 +149,7 @@
return m_mod.Controller.Reader.SearchCoreType (name);
}
- public uint GetRidFor (IMetadataTokenProvider tp)
+ public static uint GetRidFor (IMetadataTokenProvider tp)
{
return tp.MetadataToken.RID;
}
@@ -169,7 +169,7 @@
return (uint) m_mod.ModuleReferences.IndexOf (modRef) +
1;
}
- bool IsTypeSpec (TypeReference type)
+ static bool IsTypeSpec (TypeReference type)
{
return type is TypeSpecification || type is
GenericParameter;
}
@@ -179,7 +179,7 @@
if (IsTypeSpec (type)) {
uint sig = m_sigWriter.AddTypeSpec
(GetTypeSpecSig (type));
if (m_typeSpecCache.Contains (sig))
- return (m_typeSpecCache [sig] as
TypeReference).MetadataToken;
+ return ((TypeReference) m_typeSpecCache
[sig]).MetadataToken;
TypeSpecTable tsTable =
m_tableWriter.GetTypeSpecTable ();
TypeSpecRow tsRow =
m_rowWriter.CreateTypeSpecRow (sig);
@@ -228,7 +228,7 @@
foreach (TypeDefinition t in types)
m_typeDefStack.Add (t);
- (m_typeDefStack as ArrayList).Sort
(TableComparers.TypeDef.Instance);
+ m_typeDefStack.Sort (TableComparers.TypeDef.Instance);
for (int i = 0; i < m_typeDefStack.Count; i++) {
TypeDefinition t = (TypeDefinition)
m_typeDefStack [i];
@@ -456,7 +456,7 @@
m_paramIndex++;
}
- bool RequiresParameterRow (MethodReturnType mrt)
+ static bool RequiresParameterRow (MethodReturnType mrt)
{
return mrt.HasConstant || mrt.MarshalSpec != null ||
mrt.CustomAttributes.Count > 0 ||
mrt.Parameter.Attributes != (ParameterAttributes) 0;
@@ -781,7 +781,7 @@
GenericParamTable gpTable =
m_tableWriter.GetGenericParamTable ();
GenericParamConstraintTable gpcTable =
m_tableWriter.GetGenericParamConstraintTable ();
- (m_genericParamStack as ArrayList).Sort
(TableComparers.GenericParam.Instance);
+ m_genericParamStack.Sort
(TableComparers.GenericParam.Instance);
foreach (GenericParameter gp in m_genericParamStack) {
GenericParamRow gpRow =
m_rowWriter.CreateGenericParamRow (
@@ -856,7 +856,7 @@
m_mod.Image.MetadataRoot.Accept (m_mdWriter);
}
- public ElementType GetCorrespondingType (string fullName)
+ public static ElementType GetCorrespondingType (string fullName)
{
switch (fullName) {
case Constants.Boolean :
@@ -1302,13 +1302,13 @@
return new MethodSpec (gis);
}
- string GetObjectTypeName (object o)
+ static string GetObjectTypeName (object o)
{
Type t = o.GetType ();
return string.Concat (t.Namespace, ".", t.Name);
}
- CustomAttrib.Elem CreateElem (TypeReference type, object value)
+ static CustomAttrib.Elem CreateElem (TypeReference type, object
value)
{
CustomAttrib.Elem elem = new CustomAttrib.Elem ();
elem.Value = value;
@@ -1352,7 +1352,7 @@
return elem;
}
- CustomAttrib.FixedArg CreateFixedArg (TypeReference type,
object value)
+ static CustomAttrib.FixedArg CreateFixedArg (TypeReference
type, object value)
{
CustomAttrib.FixedArg fa = new CustomAttrib.FixedArg ();
if (value is object []) {
@@ -1371,7 +1371,7 @@
return fa;
}
- CustomAttrib.NamedArg CreateNamedArg (TypeReference type,
string name,
+ static CustomAttrib.NamedArg CreateNamedArg (TypeReference
type, string name,
object value, bool field)
{
CustomAttrib.NamedArg na = new CustomAttrib.NamedArg ();
@@ -1418,7 +1418,7 @@
return cas;
}
- public MarshalSig GetMarshalSig (MarshalSpec mSpec)
+ static MarshalSig GetMarshalSig (MarshalSpec mSpec)
{
MarshalSig ms = new MarshalSig (mSpec.NativeIntrinsic);
Modified: trunk/cecil/lib/Mono.Cecil/StructureWriter.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil/StructureWriter.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil/StructureWriter.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -47,7 +47,7 @@
get { return m_asm; }
}
- void ResetImage (ModuleDefinition mod)
+ static void ResetImage (ModuleDefinition mod)
{
Image ni = Image.CreateImage ();
ni.Accept (new CopyImageVisitor (mod.Image));
@@ -206,8 +206,8 @@
0,
m_mdWriter.AddString (module.Name),
m_mdWriter.AddGuid (module.Mvid),
- (uint) 0,
- (uint) 0);
+ 0,
+ 0);
modTable.Rows.Add (modRow);
} else {
Modified: trunk/cecil/lib/Mono.Cecil.Cil/CodeReader.cs
===================================================================
--- trunk/cecil/lib/Mono.Cecil.Cil/CodeReader.cs 2007-02-22 22:15:37 UTC
(rev 73342)
+++ trunk/cecil/lib/Mono.Cecil.Cil/CodeReader.cs 2007-02-22 22:21:26 UTC
(rev 73343)
@@ -277,7 +277,7 @@
}
}
- Instruction GetInstruction (MethodBody body, IDictionary
instructions, int offset)
+ static Instruction GetInstruction (MethodBody body, IDictionary
instructions, int offset)
{
Instruction instruction = instructions [offset] as
Instruction;
if (instruction != null)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches