public override void Add(ref DictionaryStorage storage, object key, object value) { if (key is string strKey) { PythonOps.ScopeSetMember(_context.SharedContext, _scope, strKey, value); } else { PythonScopeExtension ext = (PythonScopeExtension)_context.EnsureScopeExtension(_scope); ext.EnsureObjectKeys().Add(key, value); } }
public override void Add(object key, object value) { string strKey = key as string; if (strKey != null) { PythonOps.ScopeSetMember(_context.SharedContext, _scope, strKey, value); } else { PythonScopeExtension ext = (PythonScopeExtension)_context.EnsureScopeExtension(_scope); ext.EnsureObjectKeys().Add(key, value); } }
internal static PythonModule ExecuteSourceUnit(PythonContext context, SourceUnit /*!*/ sourceUnit) { ScriptCode compiledCode = sourceUnit.Compile(); Scope scope = compiledCode.CreateScope(); PythonModule res = ((PythonScopeExtension)context.EnsureScopeExtension(scope)).Module; compiledCode.Run(scope); return(res); }
internal static PythonModule ExecuteSourceUnit(PythonContext context, SourceUnit/*!*/ sourceUnit) { ScriptCode compiledCode = sourceUnit.Compile(); Scope scope = compiledCode.CreateScope(); PythonModule res = ((PythonScopeExtension)context.EnsureScopeExtension(scope)).Module; compiledCode.Run(scope); return res; }