@@ -44,7 +44,12 @@ function ReflectionObject(name, options) {
44
44
/**
45
45
* Resolved Features.
46
46
*/
47
- this . _features = null ;
47
+ this . _features = { } ;
48
+
49
+ /**
50
+ * Resolved Features.
51
+ */
52
+ this . _proto_features = null ;
48
53
49
54
/**
50
55
* Parent namespace.
@@ -152,7 +157,8 @@ ReflectionObject.prototype.resolve = function resolve() {
152
157
if ( this . resolved )
153
158
return this ;
154
159
this . _resolveFeatures ( ) ;
155
- this . resolved = true ;
160
+ if ( this . root instanceof Root || this . parent )
161
+ this . resolved = true ;
156
162
return this ;
157
163
} ;
158
164
@@ -166,10 +172,14 @@ ReflectionObject.prototype._resolveFeatures = function _resolveFeatures() {
166
172
// (Breaks the bundler and eslint)
167
173
// If we don't create a shallow copy, we end up also altering the parent's
168
174
// features
169
- var parentFeatures = Object . assign ( { } , this . parent . _features ) ;
170
- this . _features = Object . assign ( parentFeatures , this . _features || { } ) ;
175
+ var parentFeatures = Object . assign ( { } , this . parent . _proto_features ) ;
176
+ this . _features = Object . assign ( parentFeatures , this . _proto_features || { } ) ;
177
+ // this._proto_features = this._features;
171
178
this . parent . _resolveFeatures ( ) ;
179
+ } else {
180
+ this . _features = Object . assign ( { } , this . _proto_features ) ;
172
181
}
182
+ this . _proto_features = this . _features ;
173
183
} ;
174
184
175
185
/**
@@ -207,7 +217,7 @@ ReflectionObject.prototype.setParsedOption = function setParsedOption(name, valu
207
217
if ( ! this . parsedOptions ) {
208
218
this . parsedOptions = [ ] ;
209
219
}
210
- var isFeature = / f e a t u r e s / . test ( name ) ;
220
+ var isFeature = / ^ f e a t u r e s / . test ( name ) ;
211
221
var parsedOptions = this . parsedOptions ;
212
222
if ( propName ) {
213
223
// If setting a sub property of an option then try to merge it
@@ -236,8 +246,9 @@ ReflectionObject.prototype.setParsedOption = function setParsedOption(name, valu
236
246
237
247
if ( isFeature ) {
238
248
var features = parsedOptions . find ( x => { return Object . prototype . hasOwnProperty . call ( x , "features" ) ; } ) ;
239
- this . _features = features . features || { } ;
249
+ this . _proto_features = features . features || { } ;
240
250
}
251
+
241
252
return this ;
242
253
} ;
243
254
0 commit comments