Mercurial > projects > ddmd
diff dmd/Scope.d @ 82:e95073e26356
fixed a hack I used as a lack of copy ctor in D
author | korDen |
---|---|
date | Mon, 30 Aug 2010 18:38:35 +0400 |
parents | 43073c7c7769 |
children | ee670dd808a8 |
line wrap: on
line diff
--- a/dmd/Scope.d Mon Aug 30 15:40:51 2010 +0200 +++ b/dmd/Scope.d Mon Aug 30 18:38:35 2010 +0400 @@ -165,6 +165,17 @@ this.docbuf = enclosing.docbuf; assert(this !is enclosing); /// huh? } + + Scope clone() + { + // similar code is used in Type.clone() + // TODO: move to Util or something... + size_t size = __traits(classInstanceSize, typeof(this)); + void* mem = malloc(size); + memcpy(mem, this, size); + + return cast(typeof(this))mem; + } Scope push() {