Example #1
0
 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);
     }
 }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
        }
Example #4
0
 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;
 }