Skip to content

Commit 056ecc3

Browse files
committed
Fixed: Namespace#lookup should also check in nested namespaces (wtf)
1 parent 2a30df8 commit 056ecc3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/namespace.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChe
323323
return found;
324324
} else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))
325325
return found;
326-
}
326+
// Otherwise try each nested namespace
327+
} else
328+
for (var i = 0; i < this.nestedArray.length; ++i)
329+
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))
330+
return found;
327331
// If there hasn't been a match, try again at the parent
328332
if (this.parent === null || parentAlreadyChecked)
329333
return null;

tests/api_root-deferred.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ tape.test("extension fields", function(test) {
2828
extensionField = extendedType.get(declaringField.fullName);
2929
test.equal(extensionField, declaringField.extensionField, "should become instantly available if their extended type is knwon");
3030

31-
root.add(type = new Type("Test"));
31+
ns.remove(extendedType);
32+
type.remove(declaringField);
3233
type.add(declaringField);
3334
test.throws(function() {
3435
root.resolveAll();

0 commit comments

Comments
 (0)