aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-03-19 01:15:49 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:26:10 +0300
commit9ec4c29864a967186156a95a9ec8062d05ffa3c9 (patch)
tree83786c44e1688d305736e538cac8b25f1f5f61e5 /src
parentd235d3e4958154f8d6fdaea098e86b8495ee407e (diff)
Kill some embind duplication
Diffstat (limited to 'src')
-rwxr-xr-xsrc/embind/embind.js19
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;