public void Construct(ModuleModel model) { var gs = new RestoredGlobalScope(model, this); GlobalScope = gs; gs.ReconstructVariables(); }
/// <summary> /// Constructs module global scope. This is separate from regular constructor /// in order to better handle reentrancy due to circular references /// in the module factory. /// </summary> public void Construct(ModuleModel model) { var rs = new RestoredGlobalScope(model, this, Services); GlobalScope = rs; rs.Construct(model, Services); }
/// <summary> /// Creates global scope from module persistent state. /// Global scope is then can be used to construct module analysis. /// </summary> /// <param name="module">Python module to restore analysis for.</param> /// <param name="gs">Python module global scope.</param> public bool TryRestoreGlobalScope(IPythonModule module, out IRestoredGlobalScope gs) { gs = null; if (GetCachingLevel() == AnalysisCachingLevel.None || !module.ModuleType.CanBeCached()) { return(false); } if (FindModuleModel(module.Name, module.FilePath, module.ModuleType, out var model)) { gs = new RestoredGlobalScope(model, module); } return(gs != null); }