Created
April 16, 2013 11:30
-
-
Save otf/5395241 to your computer and use it in GitHub Desktop.
最適化されたAndAlsoとOrElseを正しく解釈する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instruction ConditionalBranch(Instruction instruction, Func<Expression, BinaryExpression> condition) | |
{ | |
var val1 = stack.Pop(); | |
var test = condition(val1); | |
var left = (Instruction)instruction.Operand; | |
var right = instruction.Next; | |
Instruction common = GetJoinPoint(left, right); | |
var rightExpression = Clone().Process(right, common); | |
var leftExpression = AdjustType(Clone().Process(left, common), rightExpression.Type); | |
var expression = BuildConditionalBranch(test, val1, leftExpression, rightExpression); | |
stack.Push(expression); | |
// ここをs追加 | |
if (expression.NodeType == ExpressionType.AndAlso || expression.NodeType == ExpressionType.OrElse) | |
while (common.OpCode != OpCodes.Ret) common = common.Next; | |
// ここまで | |
return common; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment