diff options
author | Chad Austin <chad@imvu.com> | 2013-03-19 01:15:49 -0700 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:26:10 +0300 |
commit | 9ec4c29864a967186156a95a9ec8062d05ffa3c9 (patch) | |
tree | 83786c44e1688d305736e538cac8b25f1f5f61e5 /src | |
parent | d235d3e4958154f8d6fdaea098e86b8495ee407e (diff) |
Kill some embind duplication
Diffstat (limited to 'src')
-rwxr-xr-x | src/embind/embind.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 520ca269..de87dceb 100755 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -661,6 +661,14 @@ function RegisteredClass( this.downcast = downcast; } +function shallowCopy(o) { + var rv = {}; + for (var k in o) { + rv[k] = o[k]; + } + return rv; +} + function __embind_register_class( rawType, rawPointerType, @@ -726,10 +734,7 @@ function __embind_register_class( var clone = Object.create(Handle.prototype); Object.defineProperty(clone, '$$', { - value: { - count: this.$$.count, - ptr: this.$$.ptr, - }, + value: shallowCopy(this.$$), }); clone.$$.count.value += 1; @@ -998,11 +1003,7 @@ function __embind_register_smart_ptr( var clone = Object.create(Handle.prototype); Object.defineProperty(clone, '$$', { - value: { - count: this.$$.count, - smartPtr: this.$$.smartPtr, - ptr: this.$$.ptr, - }, + value: shallowCopy(this.$$), }); clone.$$.count.value += 1; |