private IfElseStatement CreateIfElse(ConditionalExpression sourceExp, DataElement target) { Expression targetExp; if (target is BusSignal) { targetExp = new MemberReferenceExpression() { SourceExpression = sourceExp.SourceExpression, SourceResultType = target.CecilType, Target = target }; } else { targetExp = new IdentifierExpression() { SourceExpression = sourceExp.SourceExpression, SourceResultType = target.CecilType, Target = target }; } var ies = new IfElseStatement() { Condition = sourceExp.ConditionExpression, TrueStatement = new ExpressionStatement() { Expression = new AssignmentExpression() { SourceResultType = targetExp.SourceResultType, SourceExpression = sourceExp.SourceExpression, Left = targetExp, Right = sourceExp.TrueExpression } }, FalseStatement = new ExpressionStatement() { Expression = new AssignmentExpression() { SourceResultType = targetExp.SourceResultType, SourceExpression = sourceExp.SourceExpression, Left = targetExp, Right = sourceExp.FalseExpression } }, }; sourceExp.PrependStatement(ies); ies.UpdateParents(); return(ies); }