public override EntityModel.CustomFunctionModel.Statements.BaseStatement Clone(EntityModel.CustomFunctionModel.Support.FunctionContext functionContext)
        {
            var tmpObj = new StillOneScriptCore.EntityModel.CustomFunctionModel.Statements.ExpressionStatement(functionContext);

            if (mExpression != null)
            {
                tmpObj.Expression = mExpression.Clone(functionContext);
            }

            this.BaseStatement_SupportClone(tmpObj, functionContext);

            return tmpObj;
        }
예제 #2
0
        private static void TSTCustomFunction()
        {
            var tmpEnvironment = new StillOneScriptCore.Engine.EngineEnvironment();

            tmpEnvironment.Init();

            var tmpCustomFun = new StillOneScriptCore.EntityModel.LngObjectsModel.Support.Internal._P_CustomFunction(tmpEnvironment);

            var tmpExprStatement = new StillOneScriptCore.EntityModel.CustomFunctionModel.Statements.ExpressionStatement(tmpCustomFun.FunctionContext);

            var tmpCodeBlock = new StillOneScriptCore.EntityModel.CustomFunctionModel.Statements.CodeBlockStatement(tmpCustomFun.FunctionContext);

            tmpCustomFun.Statement = tmpCodeBlock;

            tmpCodeBlock.FirstStatement = tmpExprStatement;

            var tmpObjRef = new StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.VariableReference(tmpCustomFun.FunctionContext, "Console");

            var tmpStringRef = new StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.StringLiteralReference(tmpCustomFun.FunctionContext, "The Beatles");

            var tmpCallOperator = new StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.CallMethodOperator(tmpCustomFun.FunctionContext, "Log");

            tmpCallOperator.Left = tmpObjRef;

            var tmpParam = new StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.FunctionParameter();

            tmpParam.Name = "text";

            tmpParam.Operator = tmpStringRef;

            tmpCallOperator.AddParameter(tmpParam);

            tmpExprStatement.Expression = tmpCallOperator;

            //tmpCustomFun.Call();

            var tmpCustomFunObj = tmpEnvironment.ConvertMember(tmpCustomFun);

            NLog.LogManager.GetCurrentClassLogger().Info(StillOneScriptCore.Common.TypeHelpers.ObjectHelper._ToString(tmpCustomFunObj, "tmpCustomFunObj"));

            var tmpRez = tmpCustomFunObj.Call();

            NLog.LogManager.GetCurrentClassLogger().Info(StillOneScriptCore.Common.TypeHelpers.ObjectHelper._ToString(tmpRez, "tmpRez"));
        }