Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 template<class Traits> | 1009 template<class Traits> |
| 1010 ParserBase<Traits>::FunctionState::~FunctionState() { | 1010 ParserBase<Traits>::FunctionState::~FunctionState() { |
| 1011 *scope_stack_ = outer_scope_; | 1011 *scope_stack_ = outer_scope_; |
| 1012 *function_state_stack_ = outer_function_state_; | 1012 *function_state_stack_ = outer_function_state_; |
| 1013 Traits::TearDownFunctionState(this); | 1013 Traits::TearDownFunctionState(this); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 | 1016 |
| 1017 template<class Traits> | 1017 template<class Traits> |
| 1018 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) { | 1018 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) { |
| 1019 // We don't report stack overflows here, to avoid increasing the | 1019 if (stack_overflow()) { |
|
Michael Starzinger
2014/03/12 13:45:08
All cases below call through to ReportMessageAt, w
marja
2014/03/12 13:50:40
Done; updated description to explain in detail why
| |
| 1020 // stack depth even further. Instead we report it after parsing is | 1020 // Suppress the error message in the presence of a stack overflow. The |
| 1021 // over, in ParseProgram. | 1021 // isolate allows only one pending exception at at time and we want to |
| 1022 if (token == Token::ILLEGAL && stack_overflow()) { | 1022 // report the stack overflow later. |
| 1023 return; | 1023 return; |
| 1024 } | 1024 } |
| 1025 Scanner::Location source_location = scanner()->location(); | 1025 Scanner::Location source_location = scanner()->location(); |
| 1026 | 1026 |
| 1027 // Four of the tokens are treated specially | 1027 // Four of the tokens are treated specially |
| 1028 switch (token) { | 1028 switch (token) { |
| 1029 case Token::EOS: | 1029 case Token::EOS: |
| 1030 return ReportMessageAt(source_location, "unexpected_eos"); | 1030 return ReportMessageAt(source_location, "unexpected_eos"); |
| 1031 case Token::NUMBER: | 1031 case Token::NUMBER: |
| 1032 return ReportMessageAt(source_location, "unexpected_token_number"); | 1032 return ReportMessageAt(source_location, "unexpected_token_number"); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1541 "accessor_get_set"); | 1541 "accessor_get_set"); |
| 1542 } | 1542 } |
| 1543 *ok = false; | 1543 *ok = false; |
| 1544 } | 1544 } |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 | 1547 |
| 1548 } } // v8::internal | 1548 } } // v8::internal |
| 1549 | 1549 |
| 1550 #endif // V8_PREPARSER_H | 1550 #endif // V8_PREPARSER_H |
| OLD | NEW |