/// <summary> /// This method returns the ScriptScope in which a ScriptSource of given path was executed. /// /// The ScriptSource.Path property is the key to finding the ScriptScope. Hosts need /// to make sure they create a ScriptSource and set its Path property appropriately. /// /// GetScope is primarily useful for tools that need to map files to their execution scopes. For example, /// an editor and interpreter tool might run a file Foo that imports or requires a file Bar. /// /// The editor's user might later open the file Bar and want to execute expressions in its context. /// The tool would need to find Bar's ScriptScope for setting the appropriate context in its interpreter window. /// This method helps with this scenario. /// </summary> public ScriptScope GetScope(string path) { ContractUtils.RequiresNotNull(path, "path"); Scope scope = _language.GetScope(path); return((scope != null) ? new ScriptScope(this, scope) : null); }
/// <summary> /// This method returns the ScriptScope in which a ScriptSource of given path was executed. /// /// The ScriptSource.Path property is the key to finding the ScriptScope. Hosts need /// to make sure they create a ScriptSource and set its Path property appropriately. /// /// GetScope is primarily useful for tools that need to map files to their execution scopes. For example, /// an editor and interpreter tool might run a file Foo that imports or requires a file Bar. /// /// The editor's user might later open the file Bar and want to execute expressions in its context. /// The tool would need to find Bar's ScriptScope for setting the appropriate context in its interpreter window. /// This method helps with this scenario. /// </summary> public ScriptScope GetScope(string path) { ContractUtils.RequiresNotNull(path, nameof(path)); Scope scope = LanguageContext.GetScope(path); return((scope != null) ? new ScriptScope(this, scope) : null); }