public SetExtension ( ContextId languageContextId, Microsoft.Scripting.Runtime.ScopeExtension extension ) : Microsoft.Scripting.Runtime.ScopeExtension | ||
languageContextId | ContextId | |
extension | Microsoft.Scripting.Runtime.ScopeExtension | |
리턴 | Microsoft.Scripting.Runtime.ScopeExtension |
/// <summary> /// Creates a new ModuleContext which is backed by the specified dictionary. /// </summary> public ModuleContext(PythonDictionary/*!*/ globals, PythonContext/*!*/ creatingContext) { ContractUtils.RequiresNotNull(globals, "globals"); ContractUtils.RequiresNotNull(creatingContext, "creatingContext"); _globals = globals; _pyContext = creatingContext; _globalScope = new Scope(globals); _globalContext = new CodeContext(globals, this); _module = new PythonModule(globals, _globalScope); _globalScope.SetExtension(_pyContext.ContextId, new PythonScopeExtension(_pyContext, _module, this)); }
// TODO: remove public ScopeExtension EnsureScopeExtension(Scope scope) { ContractUtils.RequiresNotNull(scope, "scope"); ScopeExtension extension = scope.GetExtension(ContextId); if (extension == null) { extension = CreateScopeExtension(scope); if (extension == null) { throw Error.MustReturnScopeExtension(); } return(scope.SetExtension(ContextId, extension)); } return(extension); }
private Scope CreateScope() { Scope ret = new Scope(new ObjectDictionaryExpando(_dict)); ret.SetExtension(_context.ContextId, new TotemScopeExtension(_context, ret)); return ret; }