提交 30eeffce 编写于 作者: J Johannes Rieken

fix instantiation service using the wrong scope to create services

上级 cc31abab
......@@ -186,7 +186,7 @@ export class InstantiationService implements IInstantiationService {
for (let { data } of roots) {
// create instance and overwrite the service collections
const instance = this._createServiceInstance(data.desc.ctor, data.desc.staticArguments, data._trace);
const instance = this._createServiceInstanceWithOwner(data.id, data.desc.ctor, data.desc.staticArguments, data._trace);
this._setServiceInstance(data.id, instance);
graph.removeNode(data);
}
......@@ -195,6 +195,14 @@ export class InstantiationService implements IInstantiationService {
return <T>this._getServiceInstanceOrDescriptor(id);
}
private _createServiceInstanceWithOwner<T>(id: ServiceIdentifier<T>, ctor: any, args: any[] = [], _trace: Trace): T {
if (this._services.get(id) instanceof SyncDescriptor) {
return this._createServiceInstance(ctor, args, _trace);
} else {
return this._parent._createServiceInstanceWithOwner(id, ctor, args, _trace);
}
}
protected _createServiceInstance<T>(ctor: any, args: any[] = [], _trace: Trace): T {
return this._createInstance(ctor, args, _trace);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册