Mercurial > pub > Jint1
diff Jint.Runtime/VM/OpCodes/ConditionOp.cs @ 5:cb13da6e3349
simple loop test
author | cin |
---|---|
date | Mon, 28 Oct 2013 00:49:15 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM/OpCodes/ConditionOp.cs Mon Oct 28 00:49:15 2013 +0400 @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Jint.Runtime.VM.OpCodes { + class ConditionOp: IInstruction { + int m_test; + IInstruction m_success; + IInstruction m_fail; + + public ConditionOp(int test, IInstruction success, IInstruction fail) { + m_test = test; + m_success = success; + m_fail = fail; + } + + public IInstruction Invoke(Frame frame) { + return frame.GetConverted<bool>(m_test) ? m_success : m_fail; + } + } +}