コード例 #1
0
ファイル: IfBranch.cs プロジェクト: macias/Skila
        private IfBranch(IExpression condition, IEnumerable <IExpression> body, IfBranch next)
        {
            this.condition = condition;
            // we have to postpone calculating read-mode because the last instruction can be function call
            // and it is resolved only after finding its target
            if (!body.Any())
            {
                body = new[] { UnitLiteral.Create() }
            }
            ;
            this.Body = Block.Create((block) => block.Instructions.Last().ReadMode, body);
            this.Next = next;

            this.attachPostConstructor();

            this.flow = Later.Create(() => this.IsElse
                ? ExecutionFlow.CreateElse(Body, Next) : ExecutionFlow.CreateFork(Condition, Body, Next));
        }
コード例 #2
0
ファイル: IfBranch.cs プロジェクト: macias/Skila
 public static IfBranch CreateElse(IEnumerable <IExpression> body, IfBranch next = null)
 {
     return(new IfBranch(condition: null, body: body, next: next));
 }
コード例 #3
0
ファイル: IfBranch.cs プロジェクト: macias/Skila
 public static IfBranch CreateIf(IExpression condition, IEnumerable <IExpression> body, IfBranch next = null)
 {
     return(new IfBranch(condition, body, next));
 }
コード例 #4
0
ファイル: IfBranch.cs プロジェクト: macias/Skila
 public static IfBranch CreateElse(IExpression body, IfBranch next = null)
 {
     return(CreateElse(new[] { body }, next));
 }
コード例 #5
0
ファイル: IfBranch.cs プロジェクト: macias/Skila
 public static IfBranch CreateIf(IExpression condition, IExpression body, IfBranch next = null)
 {
     return(CreateIf(condition, new[] { body }, next));
 }