private LuaScope(CodeContext context) { this.context = context; this.parent = null; this.variables = new Dictionary<string, ParamExpr>(); this.labels = new Dictionary<string, LabelTarget>(); }
private LuaScope(LuaScope parent) { this.context = parent.context; this.parent = parent; this.variables = new Dictionary<string, ParamExpr>(); this.labels = new Dictionary<string, LabelTarget>(); }
public static LuaScope CreateRoot(ParamExpr dlrGlobals) { Contract.Requires(dlrGlobals != null); var scope = new LuaScope(); scope.dlrGlobals = dlrGlobals; scope.labels.Add(ReturnLabelName, Expr.Label(typeof(object))); return scope; }
public static LuaScope CreateChildFrom(LuaScope parent) { var scope = new LuaScope(parent); LabelTarget breakLabel; if (parent.labels.TryGetValue(BreakLabelName, out breakLabel)) scope.labels.Add(BreakLabelName, breakLabel); return scope; }
private void _RegisterFunction(Delegate function, LuaScope scope) { if (!_FunctionScopes.ContainsKey(function)) _FunctionScopes.Add(function, scope); else _FunctionScopes[function] = scope; }
private void _OnScopeEnter(LuaScope scope) { //accessStackExpectedSize.Push(variableAccessStack.Count); }
private IDynamicMetaObjectProvider _GetExecutionEnvironment(LuaScope scope) { LuaScope current = scope; while (current != null && !HasCustomEnvironment(current)) current = current.GetParent(); if (current != null) return GetFunctionEnvironment(current) ?? ExecutingScopeStorage; return ExecutingScopeStorage; }
internal static Expr RegisterFunction(CodeContext context, Expression function, LuaScope scope) { return CallBackingMethod("_RegisterFunction", context, function, Expr.Constant(scope)); }
public FunctionStack(CodeContext context, LuaScope upScope, LuaScope execScope, IEnumerable<string> identifiers) : this(context, upScope, execScope, Flatten(identifiers, ".")) { }
public FunctionStack(CodeContext context, LuaScope upScope, LuaScope execScope, string identifier) { ContractUtils.Requires(context != null); Context = context; UpScope = upScope; ExecScope = execScope; if (UpScope != null) UpValueNames = UpScope.GetLocalNames().ToArray(); if (ExecScope != null) LocalVariableNames = ExecScope.GetLocalNames().ToArray(); if (ExecScope != null && ExecScope.LocalsCount > 0) Locals = new Stack<VariableAccess>(); else Locals = null; Identifier = identifier; LocalVariableNames = null; LocalVariables = null; UpValueNames = null; UpValues = null; }
public void UpdateCurrentEvaluationScope(LuaScope scope) { CurrentEvaluationScope = scope; }
public static Expression MakeUpdateCurrentEvaluationScope(LuaContext context, LuaScope scope) { return Expression.Block( Expression.Call(Expression.Constant(context.Trace), UpdateCurrentEvaluationScopeMethodInfo, Expression.Constant(scope)), Expression.Call(Expression.Constant(context.Trace), UpdateScopeStorageMethodInfo, scope.GetDlrGlobals())); }
public static LuaScope CreateFunctionChildFrom(LuaScope parent) { var scope = new LuaScope(parent); scope.labels.Add(ReturnLabelName, Expr.Label(typeof(object))); return scope; }
public static LuaScope CreateRoot(CodeContext context) { Contract.Requires(context != null); var scope = new LuaScope(context); scope.labels.Add(ReturnLabelName, Expr.Label(typeof(object))); return scope; }
internal static Expr GetExecutionEnvironment(CodeContext context, LuaScope scope) { return CallBackingMethod("_GetExecutionEnvironment", context, Expr.Constant(scope)); }
internal static Expr OnScopeEnter(CodeContext context, LuaScope scope) { return CallBackingMethod("_OnScopeEnter", context, Expr.Constant(scope)); }
public FunctionStack(string identifier) { Identifier = identifier; Context = null; UpScope = null; ExecScope = null; UpValues = null; UpValueNames = null; LocalVariables = null; LocalVariableNames = null; Locals = null; }