コード例 #1
0
ファイル: LuaScope.cs プロジェクト: SPARTAN563/IronLua
 private LuaScope(CodeContext context)
 {
     this.context = context;
     this.parent = null;
     this.variables = new Dictionary<string, ParamExpr>();
     this.labels = new Dictionary<string, LabelTarget>();
 }
コード例 #2
0
ファイル: LuaScope.cs プロジェクト: SPARTAN563/IronLua
 private LuaScope(LuaScope parent)
 {
     this.context = parent.context;
     this.parent = parent;
     this.variables = new Dictionary<string, ParamExpr>();
     this.labels = new Dictionary<string, LabelTarget>();
 }
コード例 #3
0
ファイル: LuaScope.cs プロジェクト: fgretief/IronLua
 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;
 }
コード例 #4
0
ファイル: LuaScope.cs プロジェクト: fgretief/IronLua
 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;
 }
コード例 #5
0
 private void _RegisterFunction(Delegate function, LuaScope scope)
 {
     if (!_FunctionScopes.ContainsKey(function))
         _FunctionScopes.Add(function, scope);
     else
         _FunctionScopes[function] = scope;
 }
コード例 #6
0
 private void _OnScopeEnter(LuaScope scope)
 {
     //accessStackExpectedSize.Push(variableAccessStack.Count);
 }
コード例 #7
0
        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;
        }
コード例 #8
0
 internal static Expr RegisterFunction(CodeContext context, Expression function, LuaScope scope)
 {
     return CallBackingMethod("_RegisterFunction", context, function, Expr.Constant(scope));
 }
コード例 #9
0
ファイル: LuaTrace.cs プロジェクト: SPARTAN563/IronLua
 public FunctionStack(CodeContext context, LuaScope upScope, LuaScope execScope, IEnumerable<string> identifiers)
     : this(context, upScope, execScope, Flatten(identifiers, "."))
 {
 }
コード例 #10
0
ファイル: LuaTrace.cs プロジェクト: SPARTAN563/IronLua
        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;
        }
コード例 #11
0
ファイル: LuaTrace.cs プロジェクト: fgretief/IronLua
 public void UpdateCurrentEvaluationScope(LuaScope scope)
 {
     CurrentEvaluationScope = scope;
 }
コード例 #12
0
ファイル: LuaTrace.cs プロジェクト: fgretief/IronLua
 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()));
 }
コード例 #13
0
ファイル: LuaScope.cs プロジェクト: fgretief/IronLua
 public static LuaScope CreateFunctionChildFrom(LuaScope parent)
 {
     var scope = new LuaScope(parent);
     scope.labels.Add(ReturnLabelName, Expr.Label(typeof(object)));
     return scope;
 }
コード例 #14
0
ファイル: LuaScope.cs プロジェクト: SPARTAN563/IronLua
 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;
 }
コード例 #15
0
 internal static Expr GetExecutionEnvironment(CodeContext context, LuaScope scope)
 {
     return CallBackingMethod("_GetExecutionEnvironment", context, Expr.Constant(scope));
 }
コード例 #16
0
 internal static Expr OnScopeEnter(CodeContext context, LuaScope scope)
 {
     return CallBackingMethod("_OnScopeEnter", context, Expr.Constant(scope));
 }
コード例 #17
0
ファイル: LuaTrace.cs プロジェクト: SPARTAN563/IronLua
        public FunctionStack(string identifier)
        {
            Identifier = identifier;

            Context = null;
            UpScope = null;
            ExecScope = null;
            UpValues = null;
            UpValueNames = null;
            LocalVariables = null;
            LocalVariableNames = null;
            Locals = null;
        }