Beispiel #1
0
        public void Compile(ActionBranch currentAction, ActionBranch nextAction, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, bool debug)
        {
            CodeAssignStatement cas = new CodeAssignStatement();

            cas.Left = SetProperty.GetReferenceCode(methodToCompile);
            if (cas.Left == null)
            {
                compiler.AddError("Error: CustomSetter missing property");
            }
            else
            {
                CodeExpression rt = Value.GetReferenceCode(methodToCompile);
                CodeMethodReferenceExpression cmr = rt as CodeMethodReferenceExpression;
                if (cmr != null)
                {
                    rt = new CodeMethodInvokeExpression(cmr);
                }
                if (nextAction != null && nextAction.UseInput)
                {
                    CodeVariableDeclarationStatement output = new CodeVariableDeclarationStatement(
                        currentAction.OutputType.TypeString, currentAction.OutputCodeName, rt);
                    statements.Add(output);
                    rt = new CodeVariableReferenceExpression(currentAction.OutputCodeName);
                }
                cas.Right = rt;
                statements.Add(cas);
            }
        }