aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-03 13:40:01 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-03 13:40:01 -0700
commit1e3e0e5cf1ab9866faadbce1b1861d9fd79a80fb (patch)
tree7219f013034ead2e3926bc83e75ab3191d80db5e /src
parent6c531cbf21e4b332f963b977434dc897e914ca7b (diff)
parent8237fb35bcfb721eefb9c1608856b36a6adb852e (diff)
Merge pull request #1126 from imvu/more_embind_updates
More embind updates
Diffstat (limited to 'src')
-rwxr-xr-xsrc/embind/embind.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 988526b4..cadee700 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -1054,6 +1054,32 @@ function getInstanceTypeName(handle) {
return handle.$$.ptrType.registeredClass.name;
}
+ClassHandle.prototype.isAliasOf = function(other) {
+ if (!(this instanceof ClassHandle)) {
+ return false;
+ }
+ if (!(other instanceof ClassHandle)) {
+ return false;
+ }
+
+ var leftClass = this.$$.ptrType.registeredClass;
+ var left = this.$$.ptr;
+ var rightClass = other.$$.ptrType.registeredClass;
+ var right = other.$$.ptr;
+
+ while (leftClass.baseClass) {
+ left = leftClass.upcast(left);
+ leftClass = leftClass.baseClass;
+ }
+
+ while (rightClass.baseClass) {
+ right = rightClass.upcast(right);
+ rightClass = rightClass.baseClass;
+ }
+
+ return leftClass === rightClass && left === right;
+};
+
ClassHandle.prototype.clone = function() {
if (!this.$$.ptr) {
throwBindingError(getInstanceTypeName(this) + ' instance already deleted');