DynamoDS/Dynamo — pull request #2101 by ke-yu (2014-08-06 05:49:19+00:00)
Title: Support indexing into the return value from multi-ouput node

This pull request is to fix [defect MAGN-4027 Raybounce (multi output) node fails to send results to output ports] (http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-4027#).

When a multi-output node is replicated, the return value from some output is not correct because array indexing is not replicated, this could be demonstrated by the following language case:
```
a = {};
a[“in”] = 24；
b = {};
b["in"] = 42;
c = {a, b};
ins = c["in"]; // no replication.
```

We cannot simply make it replicate because it is essentially equal to normal array indexing (e.g., ```a[1]```). To fix the problem, a builtin function is added:
```
def TryGetValueFromNestedDictionaries(array: var[]..[], key: var[]..[])
```
which will recursively look into the elements of array and query value from specified key. One thing we may discuss about is the structure of return value of this function. For example, for any array like ``{1, 2, {3}``, when we try to query value for key "x", shall this function return ``null``, or ``{null, null, {null}}`` or ``{null}``? Here I take the assumption that the input array is sort of "homogeneous", i.e., I don't consider about jagged array, and if this array is nested, then all sub elements have same structure, so it will return ``null`` for this case. Please go though those test cases.

The compilation of multi-output node is updated. So instead of returning a single assignment, it will return multiple assignments, e.g., for ``Color.Components`` node, it will be compiled to the following code:
```
var_1 = Color.Components(c);
var_1_out0 = TryGetValueFromNestedDictionaries(var_1, "a");
var_1_out1 = TryGetValueFromNestedDictionaries(var_1, "r");
var_1_out2 = TryGetValueFromNestedDictionaries(var_1, "g");
var_1_out3 = TryGetValueFromNestedDictionaries(var_1, "b");
```

![2014-08-06_1321](https://cloud.githubusercontent.com/assets/2600379/3822738/5f797784-1d2d-11e4-88ec-2b2f0bea6e97.png)