public PythonGlobalVariableExpression(Expression/*!*/ globalExpr, Ast.PythonVariable/*!*/ variable, PythonGlobal/*!*/ global) { Assert.NotNull(globalExpr, variable); _target = globalExpr; _global = global; _variable = variable; }
internal PythonGlobalVariableExpression(Expression/*!*/ globalExpr, Ast.PythonVariable/*!*/ variable, PythonGlobal/*!*/ global, bool lightEh) { Assert.NotNull(globalExpr, variable); _target = globalExpr; _global = global; _variable = variable; _lightEh = lightEh; }
public override Scope CreateScope() { if (_optimizedScope == null) { CachedOptimizedCodeAttribute[] attrs = (CachedOptimizedCodeAttribute[])_code.Method.GetCustomAttributes(typeof(CachedOptimizedCodeAttribute), false); // create the CompilerContext for the ScriptCode CachedOptimizedCodeAttribute optimizedCode = attrs[0]; // create the storage for the global scope Dictionary<SymbolId, PythonGlobal> globals = new Dictionary<SymbolId, PythonGlobal>(); PythonGlobal[] globalArray = new PythonGlobal[optimizedCode.Names.Length]; Scope scope = new Scope(new PythonDictionary(new GlobalDictionaryStorage(globals, globalArray))); CodeContext res = new CodeContext(scope, (PythonContext)SourceUnit.LanguageContext); for (int i = 0; i < optimizedCode.Names.Length; i++) { SymbolId name = SymbolTable.StringToId(optimizedCode.Names[i]); globalArray[i] = globals[name] = new PythonGlobal(res, name); } _optimizedScope = scope; } return _optimizedScope; }
internal CodeContext CreateContext() { if (_optimizedContext == null) { CachedOptimizedCodeAttribute[] attrs = (CachedOptimizedCodeAttribute[])_code.Method.GetCustomAttributes(typeof(CachedOptimizedCodeAttribute), false); // create the CompilerContext for the ScriptCode CachedOptimizedCodeAttribute optimizedCode = attrs[0]; // create the storage for the global scope Dictionary<string, PythonGlobal> globals = new Dictionary<string, PythonGlobal>(StringComparer.Ordinal); PythonGlobal[] globalArray = new PythonGlobal[optimizedCode.Names.Length]; var dict = new PythonDictionary(new GlobalDictionaryStorage(globals, globalArray)); ModuleContext mc = new ModuleContext(dict, (PythonContext)SourceUnit.LanguageContext); CodeContext res = mc.GlobalContext; for (int i = 0; i < optimizedCode.Names.Length; i++) { string name = optimizedCode.Names[i]; globalArray[i] = globals[name] = new PythonGlobal(res, name); } _optimizedContext = CreateTopLevelCodeContext(dict, (PythonContext)SourceUnit.LanguageContext); } return _optimizedContext; }
public PythonGlobalVariableExpression(Expression /*!*/ globalExpr, Ast.PythonVariable /*!*/ variable, PythonGlobal /*!*/ global) : this(globalExpr, variable, global, false) { }
public PythonSetGlobalInstruction(PythonGlobal global) { _global = global; }
public PythonLightThrowGlobalInstruction(PythonGlobal global) : base(global) { }
public PythonGlobalVariableExpression(Expression/*!*/ globalExpr, PythonGlobal global) { Assert.NotNull(globalExpr); _variable = globalExpr; _global = global; }
public PythonSetGlobalInstruction(PythonGlobal global) { _global = global; }
public GlobalDictionaryStorage(Dictionary<string, PythonGlobal/*!*/>/*!*/ globals, PythonGlobal/*!*/[]/*!*/ data) { Assert.NotNull(globals, data); _globals = globals; _data = data; }
private bool TryGetCachedValue(ref PythonGlobal storage, string name, out object value) { if (storage == null) { if (!_globals.TryGetValue(name, out storage)) { return TryGetValue(name, out value); } } value = storage.RawValue; return value != Uninitialized.Instance; }
public PythonGlobalVariableExpression(Expression/*!*/ globalExpr, Ast.PythonVariable/*!*/ variable, PythonGlobal/*!*/ global) : this(globalExpr, variable, global, false) { }
public PythonLightThrowGlobalInstruction(PythonGlobal global) : base(global) { }
public abstract MSAst.Expression GetGlobal(MSAst.Expression globalContext, int arrayIndex, PythonVariable variable, PythonGlobal global);
protected internal override void Initialize(CodeContext codeContext, Dictionary<string, PythonGlobal> globals) { _test_attr = globals["test_attr"]; _test_min = globals["min"]; base.Initialize(codeContext, globals); }
internal PythonGlobalVariableExpression(Expression /*!*/ globalExpr, Ast.PythonVariable /*!*/ variable, PythonGlobal /*!*/ global, bool lightEh) { Assert.NotNull(globalExpr, variable); _target = globalExpr; _global = global; _variable = variable; _lightEh = lightEh; }
public abstract MSAst.Expression GetGlobal(MSAst.Expression globalContext, int arrayIndex, PythonVariable variable, PythonGlobal global);
public PythonGlobalVariableExpression(Expression /*!*/ globalExpr, Ast.PythonVariable /*!*/ variable, PythonGlobal /*!*/ global) { Assert.NotNull(globalExpr, variable); _target = globalExpr; _global = global; _variable = variable; }