public void VisitNode (JSPropertySetterInvocation psi) {
            if (ParentNode is JSExpressionStatement) {
                VisitChildren(psi);
                return;
            }

            var thisReference = psi.Invocation.ThisReference;
            var valueType = psi.GetActualType(TypeSystem);
            var thisType = thisReference.GetActualType(TypeSystem);

            JSExpression tempThis;
            JSExpression[] tempArguments = new JSExpression[psi.Invocation.Arguments.Count];
            var commaElements = new List<JSExpression>();

            tempThis = Hoist(thisReference, thisType, commaElements);

            for (var i = 0; i < tempArguments.Length; i++) {
                var arg = psi.Invocation.Arguments[i];
                var argType = arg.GetActualType(TypeSystem);

                tempArguments[i] = Hoist(arg, argType, commaElements);
            }

            var resultInvocation = psi.Invocation;

            if ((tempThis != null) || tempArguments.Any(ta => ta != null)) {
                resultInvocation = psi.Invocation.FilterArguments(
                    (i, a) => {
                        if ((i >= 0) && (tempArguments[i] != null))
                            return tempArguments[i];
                        else if ((i == -1) && (tempThis != null))
                            return tempThis;
                        else
                            return a;
                    }
                );
            }

            commaElements.Add(resultInvocation);

            if (tempArguments.Last() != null)
                commaElements.Add(tempArguments.Last());
            else
                commaElements.Add(psi.Value);

            var replacement = new JSCommaExpression(commaElements.ToArray());

            ParentNode.ReplaceChild(psi, replacement);
            VisitReplacement(replacement);
        }
        public void VisitNode(JSPropertySetterInvocation psi)
        {
            if (ParentNode is JSExpressionStatement)
            {
                VisitChildren(psi);
                return;
            }

            var thisReference = psi.Invocation.ThisReference;
            var valueType     = psi.GetActualType(TypeSystem);
            var thisType      = thisReference.GetActualType(TypeSystem);

            JSExpression tempThis;

            JSExpression[] tempArguments = new JSExpression[psi.Invocation.Arguments.Count];
            var            commaElements = new List <JSExpression>();

            tempThis = Hoist(thisReference, thisType, commaElements);

            for (var i = 0; i < tempArguments.Length; i++)
            {
                var arg     = psi.Invocation.Arguments[i];
                var argType = arg.GetActualType(TypeSystem);

                tempArguments[i] = Hoist(arg, argType, commaElements);
            }

            var resultInvocation = psi.Invocation;

            if ((tempThis != null) || tempArguments.Any(ta => ta != null))
            {
                resultInvocation = psi.Invocation.FilterArguments(
                    (i, a) => {
                    if ((i >= 0) && (tempArguments[i] != null))
                    {
                        return(tempArguments[i]);
                    }
                    else if ((i == -1) && (tempThis != null))
                    {
                        return(tempThis);
                    }
                    else
                    {
                        return(a);
                    }
                }
                    );
            }

            commaElements.Add(resultInvocation);

            if (tempArguments.Last() != null)
            {
                commaElements.Add(tempArguments.Last());
            }
            else
            {
                commaElements.Add(psi.Value);
            }

            var replacement = new JSCommaExpression(commaElements.ToArray());

            ParentNode.ReplaceChild(psi, replacement);
            VisitReplacement(replacement);
        }