DumpStack() public method

public DumpStack ( IList tokenlist ) : string
tokenlist IList
return string
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     CLS_Content.Value srcVal = listParam[0].ComputeValue(content);
     // 不能直接修改srcVal
     CLS_Content.Value val = new CLS_Content.Value();
     val.type = srcVal.type;
     val.value = srcVal.value;
     val.breakBlock = srcVal.breakBlock;
     val.breakBlock += 10;
     #if UNITY_EDITOR
     if (val.value is System.Collections.IEnumerator)
         throw new Exception("Dont support yield return IEnumerator, please use StartCoroutine(IEnumerator) instead: " + content.DumpStack());
     #endif
     return val;
 }
        public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            Delegate _dele = delefunc.cacheFunction(null);

            if (_dele != null)
            {
                return(_dele);
            }

            var            func = delefunc.calltype.functions[delefunc.function];
            Action <T, T1> dele;

            if (func.expr_runtime != null)
            {
                dele = (T param0, T1 param1) =>
                {
                    CLS_Content content = CLS_Content.NewContent(env);
#if UNITY_EDITOR
                    try{
#endif
                    content.CallThis = delefunc.callthis;
                    content.CallType = delefunc.calltype;
                    content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                    content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                    func.expr_runtime.ComputeValue(content);
                    CLS_Content.PoolContent(content);
#if UNITY_EDITOR
                }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                };
            }
            else
            {
                dele = (T param0, T1 param1) => { };
            }

            if (this.sysType != typeof(Action <T, T1>))
            {
                _dele = Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method);
            }
            else
            {
                _dele = dele;
            }
            return(delefunc.cacheFunction(_dele));
        }
Example #3
0
        public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            Delegate _dele = delefunc.cacheFunction(null);

            if (_dele != null)
            {
                return(_dele);
            }

            var             func = delefunc.calltype.functions[delefunc.function];
            NonVoidDelegate dele;

            if (func.expr_runtime != null)
            {
                dele = delegate(T param0, T1 param1, T2 param2)
                {
                    CLS_Content content = CLS_Content.NewContent(env);
#if UNITY_EDITOR
                    try{
#endif
                    content.CallThis = delefunc.callthis;
                    content.CallType = delefunc.calltype;
                    content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                    content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                    content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);
                    CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content);
                    CLS_Content.PoolContent(content);
                    return((ReturnType)retValue.value);

#if UNITY_EDITOR
                }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); return(default(ReturnType)); }
#endif
                };
            }
            else
            {
                dele = delegate(T param0, T1 param1, T2 param2) { return(default(ReturnType)); };
            }

            _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method);
            return(delefunc.cacheFunction(_dele));
        }
        IEnumerator CustomCoroutine(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            CLS_Content.Value retVal = null;
            ICLS_Expression   exp    = null;

            for (int i = 0, count = listParam.Count; i < count; i++)
            {
                exp = listParam[i];
                CLS_Expression_LoopFor expLoopFor = exp as CLS_Expression_LoopFor;
                if (expLoopFor != null)
                {
                    content.InStack(expLoopFor);
                    content.DepthAdd();

                    ICLS_Expression expr_init     = expLoopFor.listParam[0];
                    ICLS_Expression expr_continue = expLoopFor.listParam[1];
                    ICLS_Expression expr_step     = expLoopFor.listParam[2];
                    ICLS_Expression expr_block    = expLoopFor.listParam[3];

#if UNITY_EDITOR
                    try
                    {
#endif
                    if (expr_init != null)
                    {
                        expr_init.ComputeValue(content);
                    }
#if UNITY_EDITOR
                }
                catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                    for (;;)
                    {
#if UNITY_EDITOR
                        try
                        {
#endif
                        if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value)
                        {
                            break;
                        }
#if UNITY_EDITOR
                    }
                    catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                        if (expr_block != null)
                        {
                            if (expr_block is CLS_Expression_Block)
                            {
                                content.InStack(expr_block);
                                content.DepthAdd();
                                for (int j = 0, count2 = expr_block.listParam.Count; j < count2; j++)
                                {
#if UNITY_EDITOR
                                    try
                                    {
#endif
                                    retVal = expr_block.listParam[j].ComputeValue(content);
#if UNITY_EDITOR
                                }
                                catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                                    if (retVal != null)
                                    {
                                        if (retVal.breakBlock == 12)
                                        {
                                            CLS_Content.PoolContent(content);
                                            yield break;
                                        }
                                        else if (retVal.breakBlock == 13)
                                        {
                                            yield return(retVal.value);
                                        }
                                        else if (retVal.breakBlock > 1)
                                        {
                                            break;
                                        }
                                    }
                                }
                                content.DepthRemove();
                                content.OutStack(expr_block);
                            }
                            else
                            {
#if UNITY_EDITOR
                                try
                                {
#endif
                                retVal = expr_block.ComputeValue(content);
#if UNITY_EDITOR
                            }
                            catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                                if (retVal != null)
                                {
                                    if (retVal.breakBlock == 12)
                                    {
                                        CLS_Content.PoolContent(content);
                                        yield break;
                                    }
                                    else if (retVal.breakBlock == 13)
                                    {
                                        yield return(retVal.value);
                                    }
                                    else if (retVal.breakBlock > 1)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
#if UNITY_EDITOR
                        try
                        {
#endif
                        if (expr_step != null)
                        {
                            expr_step.ComputeValue(content);
                        }
#if UNITY_EDITOR
                    }
                    catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                    }

                    content.DepthRemove();
                    content.OutStack(expLoopFor);
                }
                else
                {
#if UNITY_EDITOR
                    try
                    {
#endif
                    retVal = exp.ComputeValue(content);
#if UNITY_EDITOR
                }
                catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                    if (retVal != null)
                    {
                        if (retVal.breakBlock == 12)
                        {
                            CLS_Content.PoolContent(content);
                            yield break;
                        }
                        else if (retVal.breakBlock == 13)
                        {
                            yield return(retVal.value);
                        }
                    }
                }
            }
            CLS_Content.PoolContent(content);
        }
Example #5
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            CLS_Content.Value srcVal = listParam[0].ComputeValue(content);
            // 不能直接修改srcVal
            CLS_Content.Value val = new CLS_Content.Value();
            val.type        = srcVal.type;
            val.value       = srcVal.value;
            val.breakBlock  = srcVal.breakBlock;
            val.breakBlock += 10;
#if UNITY_EDITOR
            if (val.value is System.Collections.IEnumerator)
            {
                throw new Exception("Dont support yield return IEnumerator, please use StartCoroutine(IEnumerator) instead: " + content.DumpStack());
            }
#endif
            return(val);
        }
        IEnumerator CustomCoroutine(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            CLS_Content.Value retVal = null;
            ICLS_Expression exp = null;
            for (int i = 0, count = listParam.Count; i < count; i++)
            {
                exp = listParam[i];
                CLS_Expression_LoopFor expLoopFor = exp as CLS_Expression_LoopFor;
                if (expLoopFor != null)
                {
                    content.InStack(expLoopFor);
                    content.DepthAdd();

                    ICLS_Expression expr_init = expLoopFor.listParam[0];
                    ICLS_Expression expr_continue = expLoopFor.listParam[1];
                    ICLS_Expression expr_step = expLoopFor.listParam[2];
                    ICLS_Expression expr_block = expLoopFor.listParam[3];

            #if UNITY_EDITOR
                    try
                    {
            #endif
                    if (expr_init != null)
                        expr_init.ComputeValue(content);
            #if UNITY_EDITOR
                    }
                    catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
            #endif
                    for (;;)
                    {
            #if UNITY_EDITOR
                        try
                        {
            #endif
                        if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value)
                            break;
            #if UNITY_EDITOR
                        }
                        catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
            #endif
                        if (expr_block != null)
                        {
                            if (expr_block is CLS_Expression_Block)
                            {
                                content.InStack(expr_block);
                                content.DepthAdd();
                                for (int j = 0, count2 = expr_block.listParam.Count; j < count2; j++)
                                {
            #if UNITY_EDITOR
                                    try
                                    {
            #endif
                                    retVal = expr_block.listParam[j].ComputeValue(content);
            #if UNITY_EDITOR
                                    }
                                    catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
            #endif
                                    if (retVal != null)
                                    {
                                        if (retVal.breakBlock == 12)
                                        {
                                            CLS_Content.PoolContent(content);
                                            yield break;
                                        }
                                        else if (retVal.breakBlock == 13)
                                            yield return retVal.value;
                                        else if (retVal.breakBlock > 1)
                                            break;
                                    }
                                }
                                content.DepthRemove();
                                content.OutStack(expr_block);
                            }
                            else
                            {
            #if UNITY_EDITOR
                                try
                                {
            #endif
                                retVal = expr_block.ComputeValue(content);
            #if UNITY_EDITOR
                                }
                                catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
            #endif
                                if (retVal != null)
                                {
                                    if (retVal.breakBlock == 12)
                                    {
                                        CLS_Content.PoolContent(content);
                                        yield break;
                                    }
                                    else if (retVal.breakBlock == 13)
                                        yield return retVal.value;
                                    else if (retVal.breakBlock > 1)
                                        break;
                                }
                            }
                        }
            #if UNITY_EDITOR
                        try
                        {
            #endif
                        if (expr_step != null)
                            expr_step.ComputeValue(content);
            #if UNITY_EDITOR
                        }
                        catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
            #endif
                    }

                    content.DepthRemove();
                    content.OutStack(expLoopFor);
                }
                else
                {
            #if UNITY_EDITOR
                    try
                    {
            #endif
                    retVal = exp.ComputeValue(content);
            #if UNITY_EDITOR
                    }
                    catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
            #endif
                    if (retVal != null)
                    {
                        if (retVal.breakBlock == 12)
                        {
                            CLS_Content.PoolContent(content);
                            yield break;
                        }
                        else if (retVal.breakBlock == 13)
                            yield return retVal.value;
                    }
                }
            }
            CLS_Content.PoolContent(content);
        }