示例#1
0
 public If(TokenSpan span, IfKind kind, IReadOnlyList <Conditional> conditionals, Else?elseBody)
 {
     Span         = span;
     Kind         = kind;
     Conditionals = conditionals;
     ElseBody     = elseBody;
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Prune"/> class.
 /// </summary>
 /// <param name="condition">Boolean expression; if it evaluates to true, then this branch
 /// is evaluated.</param>
 /// <param name="trueBranch">True if this is the node corresponding to the true branch;
 /// false if this node corresponds to the false branch.</param>
 /// <param name="kind">The type of prune instruction.</param>
 /// <param name="location">The source code location of this instruction.</param>
 public Prune(Expression condition,
              bool trueBranch,
              IfKind kind,
              Location location) : base(location)
 {
     Condition  = condition;
     TrueBranch = trueBranch;
     Kind       = kind;
 }
示例#3
0
        private IExpression If(TK whichIf, IfKind kind)
        {
            Begin();
            var conditional  = Conditional(whichIf);
            var conditionals = Collect(conditional, TryElseIf);
            var @else        = TryElse();

            Match(TK.End);

            return(new If(End(), kind, conditionals, @else));
        }