public void Visit(ThrowNode 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 #2
0
 public void Visit(ThrowNode node)
 {
     // invalid! ignore
     IsValid = false;
 }
 public void Visit(ThrowNode node)
 {
     // invalid! ignore
     IsValid = false;
 }
 public void Visit(ThrowNode node)
 {
     Debug.Fail("shouldn't get here");
 }
Example #5
0
 public void Visit(ThrowNode node)
 {
     // not applicable; terminate
 }
        public void Visit(ThrowNode 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(ThrowNode node)
 {
     Debug.Fail("shouldn't get here");
 }
Example #8
0
        //---------------------------------------------------------------------------------------
        // ParseThrowStatement
        //
        //  ThrowStatement :
        //    throw |
        //    throw Expression
        //---------------------------------------------------------------------------------------
        private AstNode ParseThrowStatement()
        {
            var throwNode = new ThrowNode(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(ThrowNode node)
 {
     // not applicable; terminate
 }