Skip to content
Snippets Groups Projects
Commit a9f3fe62 authored by Emmanouil (Manos) Koukoutos's avatar Emmanouil (Manos) Koukoutos
Browse files

Improve FunDef.duplicate. FunDef.copyContentFrom

parent be5569a8
Branches
Tags
No related merge requests found
...@@ -212,10 +212,15 @@ object Definitions { ...@@ -212,10 +212,15 @@ object Definitions {
def duplicate: FunDef = { def duplicate: FunDef = {
val fd = new FunDef(id, tparams, returnType, params) val fd = new FunDef(id, tparams, returnType, params)
fd.fullBody = fullBody fd.copyContentFrom(this)
fd.parent = parent fd.copiedFrom(this)
fd.orig = orig }
fd
def copyContentFrom(from : FunDef) {
this.fullBody = from.fullBody
this.parent = from.parent
this.orig = from.orig
this.addAnnotation(from.annotations.toSeq : _*)
} }
def hasBody = body.isDefined def hasBody = body.isDefined
......
...@@ -30,12 +30,8 @@ object MethodLifting extends TransformationPhase { ...@@ -30,12 +30,8 @@ object MethodLifting extends TransformationPhase {
val receiver = FreshIdentifier("$this").setType(recType).setPos(cd.id) val receiver = FreshIdentifier("$this").setType(recType).setPos(cd.id)
val nfd = new FunDef(id, ctParams ++ fd.tparams, fd.returnType, ValDef(receiver, recType) +: fd.params) val nfd = new FunDef(id, ctParams ++ fd.tparams, fd.returnType, ValDef(receiver, recType) +: fd.params)
nfd.postcondition = fd.postcondition nfd.copyContentFrom(fd)
nfd.precondition = fd.precondition
nfd.body = fd.body
nfd.setPos(fd) nfd.setPos(fd)
nfd.addAnnotation(fd.annotations.toSeq : _*)
mdToFds += fd -> nfd mdToFds += fd -> nfd
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment