コード例 #1
0
        public override EntityModel.CustomFunctionModel.Operators.Operator Clone(EntityModel.CustomFunctionModel.Support.FunctionContext functionContext)
        {
            var tmpObj = new StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.VariableReference(functionContext, mVariableName);

            Operator_CloneSuport(tmpObj, functionContext);

            return tmpObj;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: metatypeman/stillOneScript
        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"));
        }