Exemplo n.º 1
0
        // ArrayIndexAssignment
        private Expression Rewrite(ArrayIndexAssignment node)
        {
            Expression value = RewriteExpression(node.Value);
            Expression array = RewriteExpression(node.Array);
            Expression index = RewriteExpression(node.Index);

            // Did any of them change?
            if (((object)value != (object)node.Value) ||
                ((object)array != (object)node.Array) ||
                ((object)index != (object)node.Index))
            {
                Expression saveValue, saveArray, saveIndex;

                value = ToTemp(value, out saveValue);
                array = ToTemp(array, out saveArray);
                index = ToTemp(index, out saveIndex);

                return(Ast.Comma(
                           saveValue,
                           saveArray,
                           saveIndex,
                           Ast.AssignArrayIndex(array, index, value)
                           ));
            }
            else
            {
                return(node);
            }
        }