public virtual void BeforeVisitInput(IActionIn actionIn) { var actionOutput = actionIn.InputFrom <ActionOut>(); if (actionOutput == null) { return; } var preferedIn = actionIn.Node.InputFrom <SequenceItemNode>(); if (preferedIn == actionOutput.Node) { return; } var actionNode = actionOutput.Node as ActionNode; if (actionNode != null) { if (outputtedNodes.Contains(actionNode)) { return; } Visit(actionNode); } }
public override void VisitInput(IActionIn input) { base.VisitInput(input); //if (input.ActionFieldInfo == null) return; if (input.ActionFieldInfo != null) { if (input.ActionFieldInfo.IsGenericArgument) { return; } _.TryAddNamespace(input.ActionFieldInfo.MemberType.Namespace); var varDecl = new CodeMemberField( input.VariableType.FullName.ToCodeReference(), input.VariableName ) { InitExpression = new CodeSnippetExpression(string.Format("default( {0} )", input.VariableType.FullName)) }; _.CurrentDeclaration.Members.Add(varDecl); var variableReference = input.Item; if (variableReference != null) { _.CurrentStatements.Add(new CodeAssignStatement(new CodeSnippetExpression(input.VariableName), new CodeSnippetExpression(variableReference.VariableName))); } } var inputVariable = input.InputFrom <VariableNode>(); if (inputVariable != null) { var field = inputVariable.GetFieldStatement(); if (_.CurrentDeclaration.Members.OfType <CodeMemberField>().All(p => p.Name != field.Name)) { _.CurrentDeclaration.Members.Add(inputVariable.GetFieldStatement()); } } }
private void WriteActionInput(TemplateContext _, IActionIn output) { if (output.ActionFieldInfo != null && output.ActionFieldInfo.IsReturn) { return; } _._("{0} = {1}.{2}", output.VariableName, VariableName, output.Name); var variableReference = output.InputFrom <IContextVariable>(); if (variableReference != null) { _.CurrentStatements.Add(new CodeAssignStatement(new CodeSnippetExpression(variableReference.VariableName), new CodeSnippetExpression(output.VariableName))); } //var actionIn = output.OutputTo<IActionIn>(); //if (actionIn != null) //{ // _.CurrentStatements.Add(new CodeAssignStatement( // new CodeSnippetExpression(output.VariableName), new CodeSnippetExpression(actionIn.VariableName) // )); //} }
public override void VisitInput(IActionIn input) { base.VisitInput(input); //if (input.ActionFieldInfo == null) return; if (input.ActionFieldInfo != null) { if (input.ActionFieldInfo.IsGenericArgument) return; _.TryAddNamespace(input.ActionFieldInfo.MemberType.Namespace); var varDecl = new CodeMemberField( input.VariableType.FullName.ToCodeReference(), input.VariableName ) { InitExpression = new CodeSnippetExpression(string.Format("default( {0} )", input.VariableType.FullName)) }; _.CurrentDeclaration.Members.Add(varDecl); var variableReference = input.Item; if (variableReference != null) _.CurrentStatements.Add(new CodeAssignStatement(new CodeSnippetExpression(input.VariableName), new CodeSnippetExpression(variableReference.VariableName))); } var inputVariable = input.InputFrom<VariableNode>(); if (inputVariable != null) { var field = inputVariable.GetFieldStatement(); if (_.CurrentDeclaration.Members.OfType<CodeMemberField>().All(p => p.Name != field.Name)) { _.CurrentDeclaration.Members.Add(inputVariable.GetFieldStatement()); } } }
public virtual void BeforeVisitInput(IActionIn actionIn) { var actionOutput = actionIn.InputFrom<ActionOut>(); if (actionOutput == null) return; var preferedIn = actionIn.Node.InputFrom<SequenceItemNode>(); if (preferedIn == actionOutput.Node) return; var actionNode = actionOutput.Node as ActionNode; if (actionNode != null) { if (outputtedNodes.Contains(actionNode)) return; Visit(actionNode); } }
private void WriteActionInput(TemplateContext _, IActionIn output) { if (output.ActionFieldInfo != null && output.ActionFieldInfo.IsReturn) return; _._("{0} = {1}.{2}", output.VariableName, VariableName, output.Name); var variableReference = output.InputFrom<IContextVariable>(); if (variableReference != null) _.CurrentStatements.Add(new CodeAssignStatement(new CodeSnippetExpression(variableReference.VariableName), new CodeSnippetExpression(output.VariableName))); //var actionIn = output.OutputTo<IActionIn>(); //if (actionIn != null) //{ // _.CurrentStatements.Add(new CodeAssignStatement( // new CodeSnippetExpression(output.VariableName), new CodeSnippetExpression(actionIn.VariableName) // )); //} }