public JsNode VisitThrowStatement(ThrowStatement node)
        {
            JsExpression node2;
            IType        exceptionType;

            if (node.Expression == null || node.Expression.IsNull)             //happens when performing "throw;"
            {
                var cc = node.GetParent <CatchClause>();
                if (cc != null)
                {
                    node2 = Js.Member(cc.VariableName);
                    var type = cc.Type;
                    if (type == null || type.IsNull)
                    {
                        exceptionType = Project.Compilation.FindType(KnownTypeCode.Exception);
                    }
                    else
                    {
                        exceptionType = cc.Type.Resolve().Type;
                    }
                }
                else
                {
                    throw new Exception("Rethrow not supported, catch clause not found");
                }
            }
            else
            {
                node2 = VisitExpression(node.Expression);
                var res = node.Expression.Resolve();
                exceptionType = res.Type;
                if (res is ConversionResolveResult)
                {
                    exceptionType = ((ConversionResolveResult)res).Input.Type;
                }
            }
            if (!Sk.IsNativeError(exceptionType.GetDefinitionOrArrayType()))
            {
                node2 = Js.Member("$CreateException").Invoke(node2, Js.New(Js.Member("Error")));
            }
            return(new JsThrowStatement {
                Expression = node2
            });
        }