summaryrefslogtreecommitdiff
path: root/Source/Dafny/Cloner.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Dafny/Cloner.cs')
-rw-r--r--Source/Dafny/Cloner.cs25
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/Dafny/Cloner.cs b/Source/Dafny/Cloner.cs
index 7a057a62..6928d9b9 100644
--- a/Source/Dafny/Cloner.cs
+++ b/Source/Dafny/Cloner.cs
@@ -123,7 +123,7 @@ namespace Microsoft.Dafny
}
}
- public Type CloneType(Type t) {
+ virtual public Type CloneType(Type t) {
if (t is BasicType) {
return t;
} else if (t is SetType) {
@@ -200,7 +200,9 @@ namespace Microsoft.Dafny
return null;
} else if (expr is LiteralExpr) {
var e = (LiteralExpr)expr;
- if (e.Value == null) {
+ if (e is StaticReceiverExpr) {
+ return new StaticReceiverExpr(e.tok, e.Type);
+ } else if (e.Value == null) {
return new LiteralExpr(Tok(e.tok));
} else if (e.Value is bool) {
return new LiteralExpr(Tok(e.tok), (bool)e.Value);
@@ -706,4 +708,23 @@ namespace Microsoft.Dafny
return base.CloneStmt(stmt);
}
}
+
+
+ class ResolvedCloner : Cloner {
+
+ public override Type CloneType(Type t) {
+ Type new_t = base.CloneType(t);
+
+ if (t is UserDefinedType) {
+ var tt = (UserDefinedType)t;
+ var new_tt = (UserDefinedType)new_t;
+
+ new_tt.ResolvedClass = tt.ResolvedClass;
+ new_tt.ResolvedParam = tt.ResolvedParam;
+ }
+
+ return new_t;
+ }
+ }
+
}