DynamoDS/Dynamo — pull request #2043 by ke-yu (2014-07-25 10:25:26+00:00)
Title: Add ScopeIf node

We had a lot of discussions about how IF node could fit into recursive function workflow. But it is hard without compromise some functionality like partial application, so instead of changing the existing IF node, which is compiled to internal function ``%inlineconditional``, I added a new node ``ScopedIF`` which will be compiled to imperative if-else and put its all upstream nodes in its scope so that only one branch will be executed at run time.

But this new node has a lot of limitations, please refer to [this document] (https://docs.google.com/a/adsk-oss.com/document/d/1go80dWQRp7TAmEAddx_Fy6FOY1w7QBjHiICeeN5GIBs/edit). EB and Luke also came up with new design for [imperative IF node](https://docs.google.com/a/adsk-oss.com/document/d/18qR4CNjGGkvtjvM504gIovL9YvOuMm3WU6NRLyNRCQI/edit), so this ScopedIF could be start point for new IF node (if new one is not going to replace the old one, but just as a supplement).

The implementation is not completed yet, it still doesn't work for recursive function workflow, but the problem is because of function call doesn't work properly in nested language block. Jun is working on this issue now.

The major change in this pull request:
- Add ``ScopedNodeModel``. The typical graph node to AST node compilation process always starts from leaf nodes (after sort graph nodes in topological order). Now if there is a ScopedNodeModel in the graph, all upstream nodes of this ScopedNodeModel will be excluded from global AST compilation and be handled by ScopedNodeModel itself.
- Add ``ScopedIf`` node, which compiles all upstream nodes in imperative if-else.