aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2014-05-08 14:08:39 -0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-05-21 22:58:38 +0700
commit416a5a9715928eb56770bf1f60d735c80ea07155 (patch)
tree26eb5704f8817ab9bb406c59fd25706a427d7b9d
parent9759bdbc104d860e8eadbb0f35e0d3dedb48035d (diff)
Rename initialize to __construct to avoid conflicting with C++ function names
-rw-r--r--src/embind/embind.js4
-rw-r--r--tests/embind/embind.test.js12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 25c3191a..3aa9fef7 100644
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -1760,11 +1760,11 @@ function __embind_create_inheriting_constructor(constructorName, wrapperType, pr
Object.defineProperty(this, '__parent', {
value: wrapperPrototype
});
- this.initialize.apply(this, arraySlice.call(arguments));
+ this.__construct.apply(this, arraySlice.call(arguments));
});
// It's a little nasty that we're modifying the wrapper prototype here.
- wrapperPrototype.initialize = function initialize() {
+ wrapperPrototype.__construct = function __construct() {
var inner = baseConstructor.__$implement.apply(
undefined,
[this].concat(arraySlice.call(arguments)));
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js
index 2c274014..a1d54a09 100644
--- a/tests/embind/embind.test.js
+++ b/tests/embind/embind.test.js
@@ -1569,8 +1569,8 @@ module({
test("properties set in constructor are externally visible", function() {
var HasProperty = cm.AbstractClass.extend("HasProperty", {
- initialize: function(x) {
- this.__parent.initialize.call(this);
+ __construct: function(x) {
+ this.__parent.__construct.call(this);
this.property = x;
},
abstractMethod: function() {
@@ -1595,8 +1595,8 @@ module({
test("properties set in constructor are visible in overridden methods", function() {
var HasProperty = cm.AbstractClass.extend("HasProperty", {
- initialize: function(x) {
- this.__parent.initialize.call(this);
+ __construct: function(x) {
+ this.__parent.__construct.call(this);
this.x = x;
},
abstractMethod: function() {
@@ -1753,8 +1753,8 @@ module({
test("can extend from C++ class with constructor arguments", function() {
var parent = cm.AbstractClassWithConstructor;
var C = parent.extend("C", {
- initialize: function(x) {
- this.__parent.initialize.call(this, x);
+ __construct: function(x) {
+ this.__parent.__construct.call(this, x);
},
abstractMethod: function() {
return this.concreteMethod();