summaryrefslogtreecommitdiff
path: root/BCT/BytecodeTranslator
diff options
context:
space:
mode:
authorGravatar mikebarnett <unknown>2011-03-06 20:56:16 +0000
committerGravatar mikebarnett <unknown>2011-03-06 20:56:16 +0000
commit0cd15d2b78a68bcdc566b31d53287f63625560e7 (patch)
treea01d26f2d8b65a20c7d9dd042c8f644e671752a3 /BCT/BytecodeTranslator
parentfa74660cb6cd7251eb3e03e9e281bf37a2018242 (diff)
Fix Sink.FindOrCreateProcedure so that it takes an IMethodDefinition instead of an IMethodReference so it is guaranteed to know if the method is static or not and also to be able to access its parameters as IParameterDefinitions which is needed to know if they are out params or not.
Diffstat (limited to 'BCT/BytecodeTranslator')
-rw-r--r--BCT/BytecodeTranslator/ExpressionTraverser.cs4
-rw-r--r--BCT/BytecodeTranslator/MetadataTraverser.cs4
-rw-r--r--BCT/BytecodeTranslator/Sink.cs10
-rw-r--r--BCT/BytecodeTranslator/WholeProgram.cs2
4 files changed, 10 insertions, 10 deletions
diff --git a/BCT/BytecodeTranslator/ExpressionTraverser.cs b/BCT/BytecodeTranslator/ExpressionTraverser.cs
index bb73547a..d4897dc7 100644
--- a/BCT/BytecodeTranslator/ExpressionTraverser.cs
+++ b/BCT/BytecodeTranslator/ExpressionTraverser.cs
@@ -486,7 +486,7 @@ namespace BytecodeTranslator
outvars.Add(new Bpl.IdentifierExpr(cloc, v));
TranslatedExpressions.Push(new Bpl.IdentifierExpr(cloc, v));
}
- var proc = this.sink.FindOrCreateProcedure(resolvedMethod, resolvedMethod.IsStatic);
+ var proc = this.sink.FindOrCreateProcedure(resolvedMethod);
string methodname = proc.Name;
Bpl.QKeyValue attrib = null;
@@ -682,7 +682,7 @@ namespace BytecodeTranslator
this.StmtTraverser.StmtBuilder.Add(new Bpl.CallCmd(token, this.sink.AllocationMethodName, new Bpl.ExprSeq(), new Bpl.IdentifierExprSeq(Bpl.Expr.Ident(a))));
// Second, generate the call to the appropriate ctor
- var proc = this.sink.FindOrCreateProcedure(ctor, false);
+ var proc = this.sink.FindOrCreateProcedure(ctor.ResolvedMethod);
Bpl.ExprSeq inexpr = new Bpl.ExprSeq();
inexpr.Add(Bpl.Expr.Ident(a));
IEnumerator<IParameterDefinition> penum = ctor.ResolvedMethod.Parameters.GetEnumerator();
diff --git a/BCT/BytecodeTranslator/MetadataTraverser.cs b/BCT/BytecodeTranslator/MetadataTraverser.cs
index a83fdf09..ed91f97f 100644
--- a/BCT/BytecodeTranslator/MetadataTraverser.cs
+++ b/BCT/BytecodeTranslator/MetadataTraverser.cs
@@ -86,7 +86,7 @@ namespace BytecodeTranslator {
try
{
- var procAndFormalMap = this.sink.FindOrCreateProcedureAndReturnProcAndFormalMap(invokeMethod, invokeMethod.IsStatic);
+ var procAndFormalMap = this.sink.FindOrCreateProcedureAndReturnProcAndFormalMap(invokeMethod);
var proc = procAndFormalMap.Procedure;
var invars = proc.InParams;
var outvars = proc.OutParams;
@@ -303,7 +303,7 @@ namespace BytecodeTranslator {
this.sink.BeginMethod();
- var procAndFormalMap = this.sink.FindOrCreateProcedureAndReturnProcAndFormalMap(method, method.IsStatic);
+ var procAndFormalMap = this.sink.FindOrCreateProcedureAndReturnProcAndFormalMap(method);
if (method.IsAbstract) { // we're done, just define the procedure
return;
diff --git a/BCT/BytecodeTranslator/Sink.cs b/BCT/BytecodeTranslator/Sink.cs
index 74e095dc..c917bd9a 100644
--- a/BCT/BytecodeTranslator/Sink.cs
+++ b/BCT/BytecodeTranslator/Sink.cs
@@ -214,7 +214,7 @@ namespace BytecodeTranslator {
public Bpl.Variable ReturnVariable { get { return returnVariable; } }
}
- public Bpl.Procedure FindOrCreateProcedure(IMethodReference method, bool isStatic) {
+ public Bpl.Procedure FindOrCreateProcedure(IMethodDefinition method) {
ProcedureInfo procAndFormalMap;
var key = method; //.InternedKey;
@@ -256,7 +256,7 @@ namespace BytecodeTranslator {
Bpl.Formal/*?*/ self = null;
#region Create 'this' parameter
- if (!isStatic) {
+ if (!method.IsStatic) {
in_count++;
Bpl.Type selftype = Bpl.Type.Int;
self = new Bpl.Formal(method.Token(),
@@ -272,7 +272,7 @@ namespace BytecodeTranslator {
int j = 0;
#region Add 'this' parameter as first in parameter
- if (!isStatic)
+ if (!method.IsStatic)
invars[i++] = self;
#endregion
@@ -386,8 +386,8 @@ namespace BytecodeTranslator {
return false;
}
- public ProcedureInfo FindOrCreateProcedureAndReturnProcAndFormalMap(IMethodDefinition method, bool isStatic) {
- this.FindOrCreateProcedure(method, isStatic);
+ public ProcedureInfo FindOrCreateProcedureAndReturnProcAndFormalMap(IMethodDefinition method) {
+ this.FindOrCreateProcedure(method);
return this.declaredMethods[method];
}
private static IMethodReference Unspecialize(IMethodReference method) {
diff --git a/BCT/BytecodeTranslator/WholeProgram.cs b/BCT/BytecodeTranslator/WholeProgram.cs
index 1710b2a6..290426fc 100644
--- a/BCT/BytecodeTranslator/WholeProgram.cs
+++ b/BCT/BytecodeTranslator/WholeProgram.cs
@@ -181,7 +181,7 @@ namespace BytecodeTranslator {
var elseBranch = new Bpl.StmtListBuilder();
- var proc = this.sink.FindOrCreateProcedure(resolvedMethod, resolvedMethod.IsStatic);
+ var proc = this.sink.FindOrCreateProcedure(resolvedMethod);
var methodname = proc.Name;
Bpl.CallCmd call;