reuse name variable in share scope

This commit is contained in:
Tan Li Hau 2021-11-19 12:52:56 +08:00 committed by tanhauhau
parent 64f2bdb7a9
commit 4ed2ecfcff
1 changed files with 1 additions and 3 deletions

View File

@ -217,10 +217,8 @@ class ContainerEntryModule extends Module {
])};`,
`var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [
`if (!${RuntimeGlobals.shareScopeMap}) return;`,
`var oldScope = ${RuntimeGlobals.shareScopeMap}[${JSON.stringify(
this._shareScope
)}];`,
`var name = ${JSON.stringify(this._shareScope)}`,
`var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`,
`if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`,
`${RuntimeGlobals.shareScopeMap}[name] = shareScope;`,
`return ${RuntimeGlobals.initializeSharing}(name, initScope);`