minor tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-12-08 05:24:06 +03:00
parent d35ddc4a41
commit 449d8ceb21
2 changed files with 22 additions and 2 deletions

View File

@ -670,6 +670,7 @@ module.MetaActions = {
// Mixin a set of local actions into an object...
//
// XXX this will not work on non-actions...
mixinTo: function(to, all, descriptors, all_attr_types){
return this.mixin.call(to, this, all, descriptors, all_attr_types)
},
@ -741,6 +742,11 @@ module.MetaActions = {
mixoutFrom: function(to, all, descriptors, all_attr_types){
return this.mixout.call(to, this, all, descriptors, all_attr_types)
},
// XXX is this correct???
clone: function(){
return Object.create(this)
},
}

View File

@ -23,10 +23,11 @@ function makeConstructor(name, a, b){
var cls_proto = b == null ? b : a
var _constructor = function Constructor(){
/*
// in case this is called as a function (without new)...
if(this.constructor !== _constructor){
// NOTE: the folowing does the job of the 'new' operator but
// with one advantage, we can now pass arbitrarry args
// NOTE: the following does the job of the 'new' operator but
// with one advantage, we can now pass arbitrary args
// in...
// This is equivalent to:
// return new _constructor(json)
@ -39,6 +40,19 @@ function makeConstructor(name, a, b){
} else {
var obj = this
}
*/
// NOTE: the following does the job of the 'new' operator but
// with one advantage, we can now pass arbitrary args
// in...
// This is equivalent to:
// return new _constructor(json)
var obj = {}
obj.__proto__ = _constructor.prototype
// XXX for some reason this does not resolve from .__proto__
obj.constructor = _constructor
//obj.__proto__.constructor = _constructor
// load initial state...
if(obj.__init__ != null){