summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar mikebarnett <unknown>2011-03-03 21:27:22 +0000
committerGravatar mikebarnett <unknown>2011-03-03 21:27:22 +0000
commitccc1c910af50b211f66566c981bdb62827d814d6 (patch)
tree4ca9133612948aaaf20a89890ead37f28538c607
parent47ab7838789d58dbda038d3ded69b840528de7f2 (diff)
Fix translation of "new" so that a procedure is generated (if needed) for the called ctor.
-rw-r--r--BCT/BytecodeTranslator/ExpressionTraverser.cs6
1 files changed, 2 insertions, 4 deletions
diff --git a/BCT/BytecodeTranslator/ExpressionTraverser.cs b/BCT/BytecodeTranslator/ExpressionTraverser.cs
index 74e52cfc..afdb86e0 100644
--- a/BCT/BytecodeTranslator/ExpressionTraverser.cs
+++ b/BCT/BytecodeTranslator/ExpressionTraverser.cs
@@ -681,8 +681,8 @@ 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);
Bpl.ExprSeq inexpr = new Bpl.ExprSeq();
- Dictionary<IParameterDefinition, Bpl.Expr> p2eMap = new Dictionary<IParameterDefinition, Bpl.Expr>();
inexpr.Add(Bpl.Expr.Ident(a));
IEnumerator<IParameterDefinition> penum = ctor.ResolvedMethod.Parameters.GetEnumerator();
penum.MoveNext();
@@ -695,7 +695,6 @@ namespace BytecodeTranslator
this.Visit(exp);
Bpl.Expr e = this.TranslatedExpressions.Pop();
- p2eMap.Add(penum.Current, e);
if (!penum.Current.IsOut)
{
inexpr.Add(e);
@@ -705,9 +704,8 @@ namespace BytecodeTranslator
}
Bpl.IdentifierExprSeq outvars = new Bpl.IdentifierExprSeq();
- string methodname = TranslationHelper.CreateUniqueMethodName(ctor);
- this.StmtTraverser.StmtBuilder.Add(new Bpl.CallCmd(token, methodname, inexpr, outvars));
+ this.StmtTraverser.StmtBuilder.Add(new Bpl.CallCmd(token, proc.Name, inexpr, outvars));
// Generate assumption about the dynamic type of the just allocated object
this.StmtTraverser.StmtBuilder.Add(