コード例 #1
0
 public virtual object VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     return(constantExpressionAst);
 }
コード例 #2
0
 public virtual object VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     return(new ConstantExpressionAst(constantExpressionAst.Extent, constantExpressionAst.Value));
 }
コード例 #3
0
 public object VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     return(new CodePrimitiveExpression(constantExpressionAst.Value));
 }
コード例 #4
0
ファイル: VisitorBase.cs プロジェクト: altrive/PSCodeAnalyzer
 public override AstVisitAction VisitConstantExpression(ConstantExpressionAst ast)
 {
     return(AstVisitAction.Continue);
 }
コード例 #5
0
 public override AstVisitAction VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     return(Visit(constantExpressionAst));
 }
コード例 #6
0
        private void ConvertCommand(CommandAst commandAst)
        {
            Command command = new Command(this.GetCommandName(commandAst.CommandElements[0]), false, this._createLocalScope);

            if (commandAst.Redirections.Count > 0)
            {
                PipelineResultTypes all;
                PipelineResultTypes output = PipelineResultTypes.Output;
                switch (commandAst.Redirections[0].FromStream)
                {
                case RedirectionStream.All:
                    all = PipelineResultTypes.All;
                    break;

                case RedirectionStream.Error:
                    all = PipelineResultTypes.Error;
                    break;

                case RedirectionStream.Warning:
                    all = PipelineResultTypes.Warning;
                    break;

                case RedirectionStream.Verbose:
                    all = PipelineResultTypes.Verbose;
                    break;

                case RedirectionStream.Debug:
                    all = PipelineResultTypes.Debug;
                    break;

                default:
                    all = PipelineResultTypes.Error;
                    break;
                }
                command.MergeMyResults(all, output);
            }
            this._powershell.AddCommand(command);
            foreach (CommandElementAst ast in commandAst.CommandElements.Skip <CommandElementAst>(1))
            {
                ExpressionAst exprAst = ast as ExpressionAst;
                if (exprAst != null)
                {
                    VariableExpressionAst variableAst = null;
                    UsingExpressionAst    ast4        = ast as UsingExpressionAst;
                    if (ast4 != null)
                    {
                        variableAst = ast4.SubExpression as VariableExpressionAst;
                        if ((variableAst != null) && variableAst.Splatted)
                        {
                            IDictionary parameters = this._usingValues[ast4.RuntimeUsingIndex] as IDictionary;
                            if (parameters != null)
                            {
                                this._powershell.AddParameters(parameters);
                            }
                            else
                            {
                                IEnumerable enumerable = this._usingValues[ast4.RuntimeUsingIndex] as IEnumerable;
                                if (enumerable != null)
                                {
                                    foreach (object obj2 in enumerable)
                                    {
                                        this._powershell.AddArgument(obj2);
                                    }
                                }
                                else
                                {
                                    this._powershell.AddArgument(this._usingValues[ast4.RuntimeUsingIndex]);
                                }
                            }
                        }
                        else
                        {
                            this._powershell.AddArgument(this._usingValues[ast4.RuntimeUsingIndex]);
                        }
                    }
                    else
                    {
                        variableAst = ast as VariableExpressionAst;
                        if ((variableAst != null) && variableAst.Splatted)
                        {
                            this.GetSplattedVariable(variableAst);
                        }
                        else
                        {
                            object expressionValue;
                            ConstantExpressionAst ast5 = ast as ConstantExpressionAst;
                            if ((ast5 != null) && LanguagePrimitives.IsNumeric(LanguagePrimitives.GetTypeCode(ast5.StaticType)))
                            {
                                string text = ast5.Extent.Text;
                                expressionValue = ast5.Value;
                                if (!text.Equals(ast5.Value.ToString(), StringComparison.Ordinal))
                                {
                                    expressionValue = ParserOps.WrappedNumber(expressionValue, text);
                                }
                            }
                            else
                            {
                                expressionValue = this.GetExpressionValue(exprAst);
                            }
                            this._powershell.AddArgument(expressionValue);
                        }
                    }
                }
                else
                {
                    this.AddParameter((CommandParameterAst)ast);
                }
            }
        }
コード例 #7
0
 public object VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     _visitCount++;
     return(true);
 }
コード例 #8
0
 public override AstVisitAction VisitConstantExpression(ConstantExpressionAst ast)
 {
     return(DoNextAction(ast));
 }
コード例 #9
0
 object ICustomAstVisitor.VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 => ProcessRewriter(VisitConstantExpression, constantExpressionAst);
コード例 #10
0
 public object VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     return(constantExpressionAst.Value);
 }
コード例 #11
0
 object ICustomAstVisitor.VisitConstantExpression(ConstantExpressionAst constantExpressionAst) => VisitConstantExpression(constantExpressionAst);
コード例 #12
0
 public virtual TResult VisitConstantExpression(ConstantExpressionAst constantExpressionAst) => default(TResult);
コード例 #13
0
 public void Setup()
 {
     this._constantExpressionAst = ParseStatement("1")
                                   .PipelineElements[0]
                                   .Expression;
 }
コード例 #14
0
 public object VisitConstantExpression(ConstantExpressionAst constantExpressionAst) => null;
コード例 #15
0
 public static ConstantExpressionAst Update(this ConstantExpressionAst ast, object value = null)
 {
     return(new ConstantExpressionAst(ast.Extent, value ?? ast.Value));
 }
コード例 #16
0
ファイル: ExecutionVisitor.cs プロジェクト: JamesTryand/Pash2
 public override AstVisitAction VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     this._pipelineCommandRuntime.outputResults.Write(constantExpressionAst.Value);
     return(AstVisitAction.SkipChildren);
 }
コード例 #17
0
 public override AstVisitAction VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 {
     _currentNode = new Literal(constantExpressionAst.Value.ToString());
     return(AstVisitAction.SkipChildren);
 }
コード例 #18
0
 public override ExpressionAst VisitConstantExpression(ConstantExpressionAst constantExpressionAst)
 => VisitExpression(base.VisitConstantExpression(constantExpressionAst));
コード例 #19
0
 public override AstVisitAction VisitConstantExpression(ConstantExpressionAst constantExpressionAst) => VisitAst(constantExpressionAst);