Example #1
0
        public void Visit(JsThrowNode node)
        {
            if (node != null)
            {
                if (node.Operand != null)
                {
                    node.Operand.Accept(this);
                }

                node.Index = NextOrderIndex;

                // we can stop marking order for subsequent statements in this block,
                // since this stops execution
                m_isUnreachable = true;
            }
        }
 public void Visit(JsThrowNode node)
 {
     // starts with 'throw', so we don't care
 }
 public void Visit(JsThrowNode node)
 {
     // starts with 'throw', so we don't care
 }
 public void Visit(JsThrowNode node)
 {
     // invalid! ignore
     IsValid = false;
 }
 public void Visit(JsThrowNode node)
 {
     // invalid! ignore
     IsValid = false;
 }
Example #6
0
 public void Visit(JsThrowNode node)
 {
     // not applicable; terminate
 }
 public void Visit(JsThrowNode node)
 {
     // not applicable; terminate
 }
 public void Visit(JsThrowNode node)
 {
     Debug.Fail("shouldn't get here");
 }
Example #9
0
        //---------------------------------------------------------------------------------------
        // ParseThrowStatement
        //
        //  ThrowStatement :
        //    throw |
        //    throw Expression
        //---------------------------------------------------------------------------------------
        private JsAstNode ParseThrowStatement()
        {
            var throwNode = new JsThrowNode(m_currentToken.Clone(), this);
            GetNextToken();

            if (!m_foundEndOfLine)
            {
                if (JsToken.Semicolon != m_currentToken.Token)
                {
                    m_noSkipTokenSet.Add(NoSkipTokenSet.s_EndOfStatementNoSkipTokenSet);
                    try
                    {
                        throwNode.Operand = ParseExpression();
                    }
                    catch (RecoveryTokenException exc)
                    {
                        throwNode.Operand = exc._partiallyComputedNode;
                        if (IndexOfToken(NoSkipTokenSet.s_EndOfStatementNoSkipTokenSet, exc) == -1)
                        {
                            exc._partiallyComputedNode = throwNode;
                            throw;
                        }
                    }
                    finally
                    {
                        if (throwNode.Operand != null)
                        {
                            throwNode.UpdateWith(throwNode.Operand.Context);
                        }

                        m_noSkipTokenSet.Remove(NoSkipTokenSet.s_EndOfStatementNoSkipTokenSet);
                    }
                }

                if (m_currentToken.Token == JsToken.Semicolon)
                {
                    throwNode.TerminatingContext = m_currentToken.Clone();
                    GetNextToken();
                }
                else if (m_foundEndOfLine || m_currentToken.Token == JsToken.RightCurly || m_currentToken.Token == JsToken.EndOfFile)
                {
                    // semicolon insertion rules
                    // a right-curly or an end of line is something we don't WANT to throw a warning for.
                    // Just too common and doesn't really warrant a warning (in my opinion)
                    if (JsToken.RightCurly != m_currentToken.Token && JsToken.EndOfFile != m_currentToken.Token)
                    {
                        ReportError(JsError.SemicolonInsertion, throwNode.Context.IfNotNull(c => c.FlattenToEnd()), true);
                    }
                }
                else
                {
                    ReportError(JsError.NoSemicolon, false);
                }
            }

            return throwNode;
        }
        public void Visit(JsThrowNode node)
        {
            if (node != null)
            {
                if (node.Operand != null)
                {
                    node.Operand.Accept(this);
                }

                node.Index = NextOrderIndex;

                // we can stop marking order for subsequent statements in this block,
                // since this stops execution
                m_isUnreachable = true;
            }
        }
Example #11
0
 public void Visit(JsThrowNode node)
 {
     Debug.Fail("shouldn't get here");
 }
        public void Visit(JsThrowNode node)
        {
            if (node != null)
            {
                var symbol = StartSymbol(node);
                Output("throw");
                MarkSegment(node, null, node.Context);
                SetContextOutputPosition(node.Context);
                m_startOfStatement = false;
                if (node.Operand != null)
                {
                    m_noLineBreaks = true;
                    node.Operand.Accept(this);
                }

                if (m_settings.MacSafariQuirks)
                {
                    // force the statement ending with a semicolon
                    OutputPossibleLineBreak(';');
                    MarkSegment(node, null, node.TerminatingContext);
                }

                EndSymbol(symbol);
            }
        }