public Evaluate ( Context context, bool withvars = false ) : object | ||
context | Context | |
withvars | bool | |
Résultat | object |
public object Evaluate(Context context, bool withvars = false)
{
object message = Process.Current.GetMessage();
foreach (var match in this.matches)
{
var newcontext = match.MakeContext(message, context);
if (newcontext != null)
return match.Evaluate(newcontext);
}
Process.Current.RejectMessage(message);
return null;
}
public void ReceiveMessageWithNoMatch() { Process process = new Process(); process.Tell(new Atom("foo")); Process.Current = process; MatchBody match = new MatchBody(new Atom("ping"), new ConstantExpression("pong")); ReceiveExpression expr = new ReceiveExpression(new MatchBody[] { match }); Assert.IsFalse(expr.HasVariable()); Assert.IsNull(expr.Evaluate(null)); }