@@ -17,7 +17,7 @@ function getProperty (definition, k, isClassDescriptor)
1717 def = def . value ;
1818 }
1919
20- // This might be a regular property, or it may be a getter / setter the user defined in a class.
20+ // This might be a regular property, or it may be a getter/ setter the user defined in a class.
2121 if ( def && hasGetterOrSetter ( def ) )
2222 {
2323 if ( typeof def . enumerable === 'undefined' )
@@ -34,14 +34,7 @@ function getProperty (definition, k, isClassDescriptor)
3434 }
3535 else
3636 {
37- // if (typeof definition[k] === 'object')
38- // {
39- // return -1;
40- // }
41- // else
42- // {
43- return false ;
44- // }
37+ return false ;
4538 }
4639}
4740
@@ -67,7 +60,7 @@ function hasNonConfigurable (obj, k)
6760 return false ;
6861}
6962
70- function extend ( ctor , definition , isClassDescriptor , extendCallback )
63+ function extend ( ctor , definition , isClassDescriptor , extend )
7164{
7265 for ( var k in definition )
7366 {
@@ -76,78 +69,13 @@ function extend (ctor, definition, isClassDescriptor, extendCallback)
7669 continue ;
7770 }
7871
79- if ( typeof definition [ k ] === 'object' )
80- {
81- // Here goes nothing ...
82- extend ( ctor , def , false , extendCallback ) ;
83- }
84-
8572 var def = getProperty ( definition , k , isClassDescriptor ) ;
8673
87- // Object ...
88-
89- if ( def === - 1 )
90- {
91- console . log ( k , def ) ;
92-
93- // Iterate the object, and see if any children are getters / setters
94- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
95-
96- def = definition [ k ] ;
97-
98- var entry = { } ;
99-
100- entry [ k ] = { } ;
101-
102- // ctor.prototype[k] = {};
103- // Object.defineProperty(ctor.prototype, k, { value: {} });
104-
105- console . log ( 'iterating' , def ) ;
106-
107- for ( var key in def )
108- {
109- var child = def [ key ] ;
110-
111- console . log ( '->' , key , child ) ;
112-
113- if ( child && hasGetterOrSetter ( child ) )
114- {
115- if ( typeof child . enumerable === 'undefined' )
116- {
117- child . enumerable = true ;
118- }
119-
120- if ( typeof child . configurable === 'undefined' )
121- {
122- child . configurable = true ;
123- }
124-
125- Object . defineProperty ( entry [ k ] , key , child ) ;
126- }
127- else
128- {
129- Object . defineProperty ( entry [ k ] , key , {
130- value : child ,
131- writable : true ,
132- configurable : true ,
133- enumerable : true
134- } ) ;
135-
136- // ctor.prototype[k][key] = { value: child };
137- }
138- }
139-
140- // ctor.prototype[k] = def;
141-
142- console . dir ( entry ) ;
143-
144- Object . defineProperties ( ctor . prototype , entry ) ;
145- }
146- else if ( def !== false )
74+ if ( def !== false )
14775 {
14876 // If Extends is used, we will check its prototype to see if the final variable exists.
14977
150- var parent = extendCallback || ctor ;
78+ var parent = extend || ctor ;
15179
15280 if ( hasNonConfigurable ( parent . prototype , k ) )
15381 {
@@ -176,8 +104,6 @@ function extend (ctor, definition, isClassDescriptor, extendCallback)
176104
177105function mixin ( myClass , mixins )
178106{
179- console . log ( myClass ) ;
180-
181107 if ( ! mixins )
182108 {
183109 return ;
0 commit comments