Fixed the .cmd() syntax to also work in state machine scripts.

Since a condition edge now waits on the result of a collect
datasource, that datasource needs to implement copy/clone
semantics properly, such that when copying the state machine,
we keep referencing the correct datasource.

This patch also adds support for var SendStatus ss = foo.cmd()
in which case, the initialisation of the var is delayed until
the cmd result is known (identical behavior to:
var SendStatus ss;
ss = foo.cmd();
)

Signed-off-by: Peter Soetens <peter@thesourceworks.com>
Introduce .cmd() and .send() syntax for exported script functions

This patch adds .cmd() and .send()+collectIfDone() syntax for an exported script function
just like for a C++ operation. The patch consists of 3 parts:

1. Cleanup in CmdFunction and CallFunction : removed unused variables
2. Adding logic into the ExpressionParser to detect the case of script functions.
   Since they don't have true SendHandle objects and use SendStatus datasources,
   the parser needs to re-arrange some data sources when handling a 'SendHandleAlias'.
   The SendHandle of a script function is effectively the alias to the .send() function,
   + that a .reset() is not forwarded. Evaluating a SendHandle of a script function is
   the same as writing sh.collectIfDone().
3. Added unit tests in state_test to test all these cases.

Signed-off-by: Peter Soetens <peter@thesourceworks.com>