Author: ankit
Date: 2006-01-13 10:30:59 -0500 (Fri, 13 Jan 2006)
New Revision: 55516
Added:
trunk/mcs/ilasm/codegen/BaseMethodRef.cs
Modified:
trunk/mcs/ilasm/ChangeLog
trunk/mcs/ilasm/codegen/BaseTypeRef.cs
trunk/mcs/ilasm/codegen/ChangeLog
trunk/mcs/ilasm/codegen/CustomAttr.cs
trunk/mcs/ilasm/codegen/ExternMethodRef.cs
trunk/mcs/ilasm/codegen/ExternTypeRef.cs
trunk/mcs/ilasm/codegen/ExternTypeRefInst.cs
trunk/mcs/ilasm/codegen/GenericMethodRef.cs
trunk/mcs/ilasm/codegen/GenericParamRef.cs
trunk/mcs/ilasm/codegen/GenericTypeInst.cs
trunk/mcs/ilasm/codegen/GlobalMethodRef.cs
trunk/mcs/ilasm/codegen/ITypeRef.cs
trunk/mcs/ilasm/codegen/LdtokenInstr.cs
trunk/mcs/ilasm/codegen/MethodInstr.cs
trunk/mcs/ilasm/codegen/MethodPointerTypeRef.cs
trunk/mcs/ilasm/codegen/MethodRef.cs
trunk/mcs/ilasm/codegen/PrimitiveTypeRef.cs
trunk/mcs/ilasm/codegen/Sentinel.cs
trunk/mcs/ilasm/codegen/TypeDef.cs
trunk/mcs/ilasm/codegen/TypeRef.cs
trunk/mcs/ilasm/codegen/TypeSpecMethodRef.cs
trunk/mcs/ilasm/ilasm.exe.sources
trunk/mcs/ilasm/parser/ILParser.jay
Log:
In ilasm/codegen:
Create BaseMethodRef from IMethodRef. Replace usage of IMethodRef
with BaseMethodRef in *all* files.
Remove implementations of IMethodRef's methods from derived classes.
* BaseMethodRef.cs: New.
In ilasm:
* ilasm.exe.sources: Replace IMethodRef.cs with BaseMethodRef.cs
Modified: trunk/mcs/ilasm/ChangeLog
===================================================================
--- trunk/mcs/ilasm/ChangeLog 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/ChangeLog 2006-01-13 15:30:59 UTC (rev 55516)
@@ -1,3 +1,7 @@
+2006-01-13 Ankit Jain <[EMAIL PROTECTED]>
+
+ * ilasm.exe.sources: Replace IMethodRef.cs with BaseMethodRef.cs
+
2006-01-09 Ankit Jain <[EMAIL PROTECTED]>
* ilasm.exe.sources: Replace GenericTypeRef.cs with GenericParamRef.cs
Added: trunk/mcs/ilasm/codegen/BaseMethodRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/BaseMethodRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/BaseMethodRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -0,0 +1,58 @@
+//
+// Mono.ILASM.BaseMethodRef
+//
+// Author(s):
+// Ankit Jain <[EMAIL PROTECTED]>
+//
+// Copyright 2006 Novell, Inc (http://www.novell.com)
+//
+
+
+using System;
+
+namespace Mono.ILASM {
+ public abstract class BaseMethodRef {
+
+ protected BaseTypeRef owner;
+ protected PEAPI.CallConv call_conv;
+ protected BaseTypeRef ret_type;
+ protected string name;
+ protected BaseTypeRef[] param;
+
+ protected PEAPI.Method peapi_method;
+ protected bool is_resolved;
+ protected int gen_param_count;
+
+ public BaseMethodRef (BaseTypeRef owner, PEAPI.CallConv
call_conv,
+ BaseTypeRef ret_type, string name, BaseTypeRef[]
param, int gen_param_count)
+ {
+ this.owner = owner;
+ this.call_conv = call_conv;
+ this.ret_type = ret_type;
+ this.name = name;
+ this.param = param;
+ this.gen_param_count = gen_param_count;
+ if (gen_param_count > 0)
+ CallConv |= PEAPI.CallConv.Generic;
+ is_resolved = false;
+ }
+
+ public virtual PEAPI.Method PeapiMethod {
+ get { return peapi_method; }
+ }
+
+ public virtual PEAPI.CallConv CallConv {
+ get { return call_conv; }
+ set { call_conv = value; }
+ }
+
+ public virtual BaseTypeRef Owner {
+ get { return owner; }
+ }
+
+ public abstract void Resolve (CodeGen code_gen);
+ }
+}
+
+
+
Modified: trunk/mcs/ilasm/codegen/BaseTypeRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/BaseTypeRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/BaseTypeRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -56,23 +56,23 @@
throw new Exception ("Should not be called");
}
- public virtual IMethodRef CreateMethodRef (BaseTypeRef
ret_type,
+ public virtual BaseMethodRef CreateMethodRef (BaseTypeRef
ret_type,
PEAPI.CallConv call_conv, string name, BaseTypeRef[]
param, int gen_param_count)
{
throw new Exception ("Should not be called");
}
- public virtual IMethodRef GetMethodRef (BaseTypeRef ret_type,
+ public virtual BaseMethodRef GetMethodRef (BaseTypeRef
ret_type,
PEAPI.CallConv call_conv, string name, BaseTypeRef[]
param, int gen_param_count)
{
- IMethodRef mr = null;
+ BaseMethodRef mr = null;
/* Note: FullName not reqd as this is cached per
object */
string key = MethodDef.CreateSignature (ret_type,
name, param, gen_param_count);
if (method_table == null)
method_table = new Hashtable ();
else
- mr = (IMethodRef) method_table [key];
+ mr = (BaseMethodRef) method_table [key];
if (mr == null) {
mr = CreateMethodRef (ret_type, call_conv,
name, param, gen_param_count);
Modified: trunk/mcs/ilasm/codegen/ChangeLog
===================================================================
--- trunk/mcs/ilasm/codegen/ChangeLog 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/codegen/ChangeLog 2006-01-13 15:30:59 UTC (rev 55516)
@@ -1,5 +1,12 @@
2006-01-13 Ankit Jain <[EMAIL PROTECTED]>
+ Create BaseMethodRef from IMethodRef. Replace usage of IMethodRef
+ with BaseMethodRef in *all* files.
+ Remove implementations of IMethodRef's methods from derived classes.
+ * BaseMethodRef.cs: New.
+
+2006-01-13 Ankit Jain <[EMAIL PROTECTED]>
+
Move caching of method-refs and field-refs to BaseTypeRef, and use
CreateMethodRef & CreateFieldRef for creating the actual object.
Override these in derived classes to return the right objects.
Modified: trunk/mcs/ilasm/codegen/CustomAttr.cs
===================================================================
--- trunk/mcs/ilasm/codegen/CustomAttr.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/CustomAttr.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -19,10 +19,10 @@
public class CustomAttr {
- private IMethodRef method_ref;
+ private BaseMethodRef method_ref;
private byte[] data;
- public CustomAttr (IMethodRef method_ref, byte[] data)
+ public CustomAttr (BaseMethodRef method_ref, byte[] data)
{
this.method_ref = method_ref;
this.data = data;
Modified: trunk/mcs/ilasm/codegen/ExternMethodRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/ExternMethodRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/ExternMethodRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -13,47 +13,15 @@
namespace Mono.ILASM {
- public class ExternMethodRef : IMethodRef {
+ public class ExternMethodRef : BaseMethodRef {
- private ExternTypeRef owner;
- private BaseTypeRef ret_type;
- private string name;
- private BaseTypeRef[] param;
- private PEAPI.CallConv call_conv;
-
- private PEAPI.Method peapi_method;
- private bool is_resolved;
- private int gen_param_count;
-
public ExternMethodRef (ExternTypeRef owner, BaseTypeRef
ret_type,
PEAPI.CallConv call_conv, string name, BaseTypeRef[]
param, int gen_param_count)
+ : base (owner, call_conv, ret_type, name, param,
gen_param_count)
{
- this.owner = owner;
- this.ret_type = ret_type;
- this.name = name;
- this.param = param;
- this.call_conv = call_conv;
- this.gen_param_count = gen_param_count;
- if (gen_param_count > 0)
- CallConv |= PEAPI.CallConv.Generic;
-
- is_resolved = false;
}
- public PEAPI.Method PeapiMethod {
- get { return peapi_method; }
- }
-
- public PEAPI.CallConv CallConv {
- get { return call_conv; }
- set { call_conv = value; }
- }
-
- public BaseTypeRef Owner {
- get { return owner; }
- }
-
- public void Resolve (CodeGen code_gen)
+ public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
Modified: trunk/mcs/ilasm/codegen/ExternTypeRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/ExternTypeRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/ExternTypeRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -76,7 +76,7 @@
is_resolved = true;
}
- public override IMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
+ public override BaseMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
{
return new ExternMethodRef (this, ret_type, call_conv,
name, param, gen_param_count);
Modified: trunk/mcs/ilasm/codegen/ExternTypeRefInst.cs
===================================================================
--- trunk/mcs/ilasm/codegen/ExternTypeRefInst.cs 2006-01-13 15:18:53 UTC
(rev 55515)
+++ trunk/mcs/ilasm/codegen/ExternTypeRefInst.cs 2006-01-13 15:30:59 UTC
(rev 55516)
@@ -117,7 +117,7 @@
is_resolved = true;
}
- public IMethodRef GetMethodRef (BaseTypeRef ret_type,
PEAPI.CallConv call_conv,
+ public BaseMethodRef GetMethodRef (BaseTypeRef ret_type,
PEAPI.CallConv call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
{
string key = type_ref.FullName +
MethodDef.CreateSignature (ret_type, name, param, gen_param_count) +
type_ref.SigMod;
Modified: trunk/mcs/ilasm/codegen/GenericMethodRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/GenericMethodRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/GenericMethodRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -12,41 +12,31 @@
namespace Mono.ILASM {
- public class GenericMethodRef : IMethodRef {
+ public class GenericMethodRef : BaseMethodRef {
- private IMethodRef meth;
+ private BaseMethodRef meth;
private GenericMethodSig sig;
- private bool is_resolved;
- private PEAPI.Method ms;
- public GenericMethodRef (IMethodRef meth, GenericMethodSig sig)
+ public GenericMethodRef (BaseMethodRef meth, GenericMethodSig
sig)
+ : base (null, meth.CallConv, null, "", null, 0)
{
this.meth = meth;
this.sig = sig;
- ms = null;
is_resolved = false;
}
- public PEAPI.Method PeapiMethod {
- get { return ms; }
- }
-
- public PEAPI.CallConv CallConv {
+ public override PEAPI.CallConv CallConv {
get { return meth.CallConv; }
set { meth.CallConv = value; }
}
- public BaseTypeRef Owner {
- get { return null; }
- }
-
- public void Resolve (CodeGen code_gen)
+ public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
meth.Resolve (code_gen);
- ms = code_gen.PEFile.AddMethodSpec (meth.PeapiMethod,
sig.Resolve (code_gen));
+ peapi_method = code_gen.PEFile.AddMethodSpec
(meth.PeapiMethod, sig.Resolve (code_gen));
is_resolved = true;
}
Modified: trunk/mcs/ilasm/codegen/GenericParamRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/GenericParamRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/GenericParamRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -90,7 +90,7 @@
param.Name));
}
- public override IMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
+ public override BaseMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
{
return new TypeSpecMethodRef (this, call_conv,
ret_type, name, param, gen_param_count);
Modified: trunk/mcs/ilasm/codegen/GenericTypeInst.cs
===================================================================
--- trunk/mcs/ilasm/codegen/GenericTypeInst.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/GenericTypeInst.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -88,7 +88,7 @@
gen_args.Resolve (type_gen_params, method_gen_params);
}
- public override IMethodRef GetMethodRef (BaseTypeRef ret_type,
PEAPI.CallConv call_conv,
+ public override BaseMethodRef GetMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
string meth_name, BaseTypeRef[] param, int
gen_param_count)
{
/* Note: Using FullName here as we are caching in a
static hashtable */
Modified: trunk/mcs/ilasm/codegen/GlobalMethodRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/GlobalMethodRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/GlobalMethodRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -13,45 +13,15 @@
namespace Mono.ILASM {
- public class GlobalMethodRef : IMethodRef {
+ public class GlobalMethodRef : BaseMethodRef {
- private BaseTypeRef ret_type;
- private string name;
- private BaseTypeRef[] param;
- private PEAPI.CallConv call_conv;
-
- private PEAPI.Method peapi_method;
- private bool is_resolved;
- private int gen_param_count;
-
public GlobalMethodRef (BaseTypeRef ret_type, PEAPI.CallConv
call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
+ : base (null, call_conv, ret_type, name, param,
gen_param_count)
{
- this.ret_type = ret_type;
- this.call_conv = call_conv;
- this.name = name;
- this.param = param;
- this.gen_param_count = gen_param_count;
- if (gen_param_count > 0)
- CallConv |= PEAPI.CallConv.Generic;
-
- is_resolved = false;
}
- public PEAPI.Method PeapiMethod {
- get { return peapi_method; }
- }
-
- public PEAPI.CallConv CallConv {
- get { return call_conv; }
- set { call_conv = value; }
- }
-
- public BaseTypeRef Owner {
- get { return null; }
- }
-
- public void Resolve (CodeGen code_gen)
+ public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
Modified: trunk/mcs/ilasm/codegen/ITypeRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/ITypeRef.cs 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/codegen/ITypeRef.cs 2006-01-13 15:30:59 UTC (rev 55516)
@@ -69,7 +69,7 @@
void Resolve (CodeGen code_gen);
- IMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv
call_conv,
+ BaseMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv
call_conv,
string name, ITypeRef[] param, int
gen_param_count);
IFieldRef GetFieldRef (ITypeRef ret_type, string name);
Modified: trunk/mcs/ilasm/codegen/LdtokenInstr.cs
===================================================================
--- trunk/mcs/ilasm/codegen/LdtokenInstr.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/LdtokenInstr.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -15,7 +15,7 @@
public class LdtokenInstr : IInstr {
private IFieldRef field_ref;
- private IMethodRef method_ref;
+ private BaseMethodRef method_ref;
private BaseTypeRef type_ref;
public LdtokenInstr (IFieldRef field_ref, Location loc)
@@ -24,7 +24,7 @@
this.field_ref = field_ref;
}
- public LdtokenInstr (IMethodRef method_ref, Location loc)
+ public LdtokenInstr (BaseMethodRef method_ref, Location loc)
: base (loc)
{
this.method_ref = method_ref;
Modified: trunk/mcs/ilasm/codegen/MethodInstr.cs
===================================================================
--- trunk/mcs/ilasm/codegen/MethodInstr.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/MethodInstr.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -16,9 +16,9 @@
public class MethodInstr : IInstr {
private PEAPI.MethodOp op;
- private IMethodRef operand;
+ private BaseMethodRef operand;
- public MethodInstr (PEAPI.MethodOp op, IMethodRef operand,
Location loc)
+ public MethodInstr (PEAPI.MethodOp op, BaseMethodRef operand,
Location loc)
: base (loc)
{
this.op = op;
Modified: trunk/mcs/ilasm/codegen/MethodPointerTypeRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/MethodPointerTypeRef.cs 2006-01-13 15:18:53 UTC
(rev 55515)
+++ trunk/mcs/ilasm/codegen/MethodPointerTypeRef.cs 2006-01-13 15:30:59 UTC
(rev 55516)
@@ -78,7 +78,7 @@
is_resolved = true;
}
- public override IMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
+ public override BaseMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
{
return new TypeSpecMethodRef (this, call_conv,
ret_type, name, param, gen_param_count);
Modified: trunk/mcs/ilasm/codegen/MethodRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/MethodRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/MethodRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -13,44 +13,15 @@
namespace Mono.ILASM {
- public class MethodRef : IMethodRef {
+ public class MethodRef : BaseMethodRef {
- private TypeRef owner;
- private PEAPI.CallConv call_conv;
- private BaseTypeRef ret_type;
- private string name;
- private BaseTypeRef[] param;
-
- private PEAPI.Method peapi_method;
- private bool is_resolved;
- private int gen_param_count;
-
public MethodRef (TypeRef owner, PEAPI.CallConv call_conv,
BaseTypeRef ret_type, string name, BaseTypeRef[]
param, int gen_param_count)
+ : base (owner, call_conv, ret_type, name, param,
gen_param_count)
{
- this.owner = owner;
- this.call_conv = call_conv;
- this.ret_type = ret_type;
- this.name = name;
- this.param = param;
- this.gen_param_count = gen_param_count;
- is_resolved = false;
}
- public PEAPI.Method PeapiMethod {
- get { return peapi_method; }
- }
-
- public PEAPI.CallConv CallConv {
- get { return call_conv; }
- set { call_conv = value; }
- }
-
- public BaseTypeRef Owner {
- get { return owner; }
- }
-
- public void Resolve (CodeGen code_gen)
+ public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
Modified: trunk/mcs/ilasm/codegen/PrimitiveTypeRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/PrimitiveTypeRef.cs 2006-01-13 15:18:53 UTC (rev
55515)
+++ trunk/mcs/ilasm/codegen/PrimitiveTypeRef.cs 2006-01-13 15:30:59 UTC (rev
55516)
@@ -60,7 +60,7 @@
}
}
- public override IMethodRef GetMethodRef (BaseTypeRef ret_type,
PEAPI.CallConv call_conv,
+ public override BaseMethodRef GetMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
{
/* Use FullName also here, as we are caching in a
static hashtable */
Modified: trunk/mcs/ilasm/codegen/Sentinel.cs
===================================================================
--- trunk/mcs/ilasm/codegen/Sentinel.cs 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/codegen/Sentinel.cs 2006-01-13 15:30:59 UTC (rev 55516)
@@ -29,7 +29,7 @@
is_resolved = true;
}
- public override IMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
+ public override BaseMethodRef CreateMethodRef (BaseTypeRef
ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef[] param, int
gen_param_count)
{
return new TypeSpecMethodRef (this, call_conv,
ret_type, name, param, gen_param_count);
Modified: trunk/mcs/ilasm/codegen/TypeDef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/TypeDef.cs 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/codegen/TypeDef.cs 2006-01-13 15:30:59 UTC (rev 55516)
@@ -146,7 +146,7 @@
new DictionaryEntry (parent,
name)));
}
- public void AddOverride (string sig, IMethodRef decl)
+ public void AddOverride (string sig, BaseMethodRef decl)
{
if (override_long_list == null)
override_long_list = new ArrayList ();
@@ -427,7 +427,7 @@
BaseTypeRef parent_type =
(BaseTypeRef) decl.Key;
parent_type.Resolve (code_gen);
string over_name = (string) decl.Value;
- IMethodRef over_meth =
parent_type.GetMethodRef (body.RetType,
+ BaseMethodRef over_meth =
parent_type.GetMethodRef (body.RetType,
body.CallConv,
over_name, body.ParamTypeList (), body.GenParamCount);
over_meth.Resolve (code_gen);
classdef.AddMethodOverride
(over_meth.PeapiMethod,
@@ -438,7 +438,7 @@
if (override_long_list != null) {
foreach (DictionaryEntry entry in
override_long_list) {
string sig = (string) entry.Key;
- IMethodRef decl = (IMethodRef)
entry.Value;
+ BaseMethodRef decl = (BaseMethodRef)
entry.Value;
MethodDef body = (MethodDef)
method_table[sig];
decl.Resolve (code_gen);
classdef.AddMethodOverride
(decl.PeapiMethod,
Modified: trunk/mcs/ilasm/codegen/TypeRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/TypeRef.cs 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/codegen/TypeRef.cs 2006-01-13 15:30:59 UTC (rev 55516)
@@ -37,7 +37,7 @@
return new TypeRef (full_name, is_valuetype, location,
(ArrayList) ConversionList.Clone (), sig_mod);
}
- public override IMethodRef CreateMethodRef (BaseTypeRef
ret_type,
+ public override BaseMethodRef CreateMethodRef (BaseTypeRef
ret_type,
PEAPI.CallConv call_conv, string name, BaseTypeRef[]
param, int gen_param_count)
{
return new MethodRef (this, call_conv, ret_type,
name, param, gen_param_count);
Modified: trunk/mcs/ilasm/codegen/TypeSpecMethodRef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/TypeSpecMethodRef.cs 2006-01-13 15:18:53 UTC
(rev 55515)
+++ trunk/mcs/ilasm/codegen/TypeSpecMethodRef.cs 2006-01-13 15:30:59 UTC
(rev 55516)
@@ -13,50 +13,16 @@
namespace Mono.ILASM {
- public class TypeSpecMethodRef : IMethodRef {
+ public class TypeSpecMethodRef : BaseMethodRef {
- private PEAPI.MethodRef peapi_method;
- private BaseTypeRef owner;
-
- private PEAPI.CallConv call_conv;
- private BaseTypeRef ret_type;
- private string name;
- private BaseTypeRef[] param;
- private int gen_param_count;
-
- private bool is_resolved;
-
public TypeSpecMethodRef (BaseTypeRef owner,
PEAPI.CallConv call_conv, BaseTypeRef ret_type,
string name, BaseTypeRef[] param, int
gen_param_count)
+ : base (owner, call_conv, ret_type, name, param,
gen_param_count)
{
- this.owner = owner;
- this.call_conv = call_conv;
- this.ret_type = ret_type;
- this.name = name;
- this.param = param;
- this.gen_param_count = gen_param_count;
- if (gen_param_count > 0)
- CallConv |= PEAPI.CallConv.Generic;
- is_resolved = false;
}
- public PEAPI.Method PeapiMethod {
- get {
- return peapi_method;
- }
- }
-
- public PEAPI.CallConv CallConv {
- get { return call_conv; }
- set { call_conv = value; }
- }
-
- public BaseTypeRef Owner {
- get { return owner; }
- }
-
- public void Resolve (CodeGen code_gen)
+ public override void Resolve (CodeGen code_gen)
{
if (is_resolved)
return;
Modified: trunk/mcs/ilasm/ilasm.exe.sources
===================================================================
--- trunk/mcs/ilasm/ilasm.exe.sources 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/ilasm.exe.sources 2006-01-13 15:30:59 UTC (rev 55516)
@@ -30,7 +30,7 @@
codegen/TypeInstr.cs
codegen/MethodInstr.cs
codegen/Local.cs
-codegen/IMethodRef.cs
+codegen/BaseMethodRef.cs
codegen/ExternMethodRef.cs
codegen/MethodRef.cs
codegen/GlobalMethodRef.cs
Modified: trunk/mcs/ilasm/parser/ILParser.jay
===================================================================
--- trunk/mcs/ilasm/parser/ILParser.jay 2006-01-13 15:18:53 UTC (rev 55515)
+++ trunk/mcs/ilasm/parser/ILParser.jay 2006-01-13 15:30:59 UTC (rev 55516)
@@ -840,7 +840,7 @@
BaseTypeRef owner = (BaseTypeRef) $2;
ArrayList arg_list = (ArrayList) $11;
BaseTypeRef[] param_list;
- IMethodRef decl;
+ BaseMethodRef decl;
if (arg_list != null)
param_list = (BaseTypeRef[])
arg_list.ToArray (typeof (BaseTypeRef));
@@ -2331,7 +2331,7 @@
| INSTR_METHOD method_ref
{
codegen.CurrentMethodDef.AddInstr (new
MethodInstr ((MethodOp) $1,
- (IMethodRef) $2, tokenizer.Location));
+ (BaseMethodRef) $2,
tokenizer.Location));
}
| INSTR_FIELD type type_spec DOUBLE_COLON id
{
@@ -2387,8 +2387,8 @@
| INSTR_TOK owner_type
{
if ((MiscInstr) $1 == MiscInstr.ldtoken) {
- if ($2 is IMethodRef)
-
codegen.CurrentMethodDef.AddInstr (new LdtokenInstr ((IMethodRef) $2,
tokenizer.Location));
+ if ($2 is BaseMethodRef)
+
codegen.CurrentMethodDef.AddInstr (new LdtokenInstr ((BaseMethodRef) $2,
tokenizer.Location));
else if ($2 is IFieldRef)
codegen.CurrentMethodDef.AddInstr (new LdtokenInstr ((IFieldRef) $2,
tokenizer.Location));
else
@@ -2408,7 +2408,7 @@
BaseTypeRef owner = (BaseTypeRef) $3;
ArrayList arg_list = (ArrayList) $7;
BaseTypeRef[] param_list;
- IMethodRef methref;
+ BaseMethodRef methref;
if (arg_list != null)
param_list = (BaseTypeRef[])
arg_list.ToArray (typeof (BaseTypeRef));
@@ -2452,7 +2452,7 @@
else
param_list = new BaseTypeRef[0];
- IMethodRef methref = codegen.GetGlobalMethodRef
((BaseTypeRef) $2, (CallConv) $1,
+ BaseMethodRef methref =
codegen.GetGlobalMethodRef ((BaseTypeRef) $2, (CallConv) $1,
(string) $3, param_list, (ga != null ?
ga.Count : 0));
if (ga != null)
@@ -2467,7 +2467,7 @@
ArrayList arg_list = (ArrayList) $8;
GenericArguments ga = (GenericArguments) $6;
BaseTypeRef[] param_list;
- IMethodRef methref;
+ BaseMethodRef methref;
if (arg_list != null)
param_list = (BaseTypeRef[])
arg_list.ToArray (typeof (BaseTypeRef));
@@ -2660,12 +2660,12 @@
customattr_decl : D_CUSTOM custom_type
{
- $$ = new CustomAttr ((IMethodRef) $2, null);
+ $$ = new CustomAttr ((BaseMethodRef) $2, null);
}
| D_CUSTOM custom_type ASSIGN comp_qstring
| D_CUSTOM custom_type ASSIGN bytes_list
{
- $$ = new CustomAttr ((IMethodRef) $2,
+ $$ = new CustomAttr ((BaseMethodRef) $2,
(byte[]) $4);
}
| D_CUSTOM OPEN_PARENS owner_type CLOSE_PARENS
custom_type
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches