Example #1
0
 public SwitchStatementAst(IScriptExtent extent, string label, PipelineBaseAst condition, SwitchFlags flags, IEnumerable<Tuple<ExpressionAst, StatementBlockAst>> clauses, StatementBlockAst @default)
     : base(extent, label, condition)
 {
     this.Flags = flags;
     this.Clauses = clauses.ToReadOnlyCollection();
     this.Default = @default;
 }
Example #2
0
 public SwitchStatementAst(IScriptExtent extent, string label, PipelineBaseAst condition, SwitchFlags flags, IEnumerable<Tuple<ExpressionAst, StatementBlockAst>> clauses, StatementBlockAst @default) : base(extent, label, condition)
 {
     if (((clauses == null) || !clauses.Any<Tuple<ExpressionAst, StatementBlockAst>>()) && (@default == null))
     {
         throw PSTraceSource.NewArgumentException("clauses");
     }
     this.Flags = flags;
     this.Clauses = new ReadOnlyCollection<Tuple<ExpressionAst, StatementBlockAst>>(((clauses != null) && clauses.Any<Tuple<ExpressionAst, StatementBlockAst>>()) ? ((IList<Tuple<ExpressionAst, StatementBlockAst>>) clauses.ToArray<Tuple<ExpressionAst, StatementBlockAst>>()) : ((IList<Tuple<ExpressionAst, StatementBlockAst>>) EmptyClauseArray));
     base.SetParents<ExpressionAst, StatementBlockAst>(this.Clauses);
     if (@default != null)
     {
         this.Default = @default;
         base.SetParent(@default);
     }
 }
 internal static PSSwitchClauseEvalBinder Get(SwitchFlags flags)
 {
     PSSwitchClauseEvalBinder pSSwitchClauseEvalBinder;
     lock (PSSwitchClauseEvalBinder._binderCache)
     {
         PSSwitchClauseEvalBinder pSSwitchClauseEvalBinder1 = PSSwitchClauseEvalBinder._binderCache[(int)flags];
         PSSwitchClauseEvalBinder pSSwitchClauseEvalBinder2 = pSSwitchClauseEvalBinder1;
         if (pSSwitchClauseEvalBinder1 == null)
         {
             PSSwitchClauseEvalBinder pSSwitchClauseEvalBinder3 = new PSSwitchClauseEvalBinder(flags);
             PSSwitchClauseEvalBinder pSSwitchClauseEvalBinder4 = pSSwitchClauseEvalBinder3;
             PSSwitchClauseEvalBinder._binderCache[(int)flags] = pSSwitchClauseEvalBinder3;
             pSSwitchClauseEvalBinder2 = pSSwitchClauseEvalBinder4;
         }
         pSSwitchClauseEvalBinder = pSSwitchClauseEvalBinder2;
     }
     return pSSwitchClauseEvalBinder;
 }
 private PSSwitchClauseEvalBinder(SwitchFlags flags)
 {
     this._flags = flags;
 }