/* * public override Object VisitCommand(CodeQuery.CommandContext context) * { * var expression = context.expression().Accept(this); * * if (expression is CommandCallElement) * { * var methodCallElement = (CommandCallElement)expression; * var operators = context.COMMAND_OPERATOR().ToArray(); * * if (!operators.Any()) * { * return TreeFactory.CreateControlFlow(methodCallElement); * } * * for (var i = 0; i < operators.Length; i++) * { * var op = operators[i]; * var command = context.command().ToArray()[i]; * * var pipelineOperator = op.GetText(); * var rightExpression = command.Accept(this) as ControlFlowElementBase; * * if (methodCallElement != null) * { * return TreeFactory.CreateControlFlow(pipelineOperator, methodCallElement, rightExpression); * } * } * } * else if (expression is BaseSelectorElement) * { * var selectorElement = ((BaseSelectorElement)expression); * return TreeFactory.CreateControlFlow(selectorElement); * } * * return null; * } */ public override Object VisitCommandOperand(CodeQueryParser.CommandOperandContext context) { var left = context.Left.Accept(this) as ControlFlowElementBase; var right = context.Right.Accept(this) as ControlFlowElementBase; var pipelineOperator = context.Operator.Text; return(TreeFactory.CreateControlFlow(left, right, pipelineOperator)); }
public override Object VisitCommandExpression(CodeQueryParser.CommandExpressionContext context) { var expression = context.Expression.Accept(this); if (expression is CommandCallElement) { var methodCall = (CommandCallElement)expression; return(TreeFactory.CreateControlFlow(methodCall)); } else if (expression is SelectorElementBase) { var selector = (SelectorElementBase)expression; return(TreeFactory.CreateControlFlow(selector)); } return(base.VisitCommandExpression(context)); }