| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
| 6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
| 7 | 7 |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 | 120 |
| 121 // ---------------------------------------------------------------------------- | 121 // ---------------------------------------------------------------------------- |
| 122 // The CHECK_OK macro is a convenient macro to enforce error | 122 // The CHECK_OK macro is a convenient macro to enforce error |
| 123 // handling for functions that may fail (by returning !*ok). | 123 // handling for functions that may fail (by returning !*ok). |
| 124 // | 124 // |
| 125 // CAUTION: This macro appends extra statements after a call, | 125 // CAUTION: This macro appends extra statements after a call, |
| 126 // thus it must never be used where only a single statement | 126 // thus it must never be used where only a single statement |
| 127 // is correct (e.g. an if statement branch w/o braces)! | 127 // is correct (e.g. an if statement branch w/o braces)! |
| 128 | 128 |
| 129 #define CHECK_OK ok); \ | |
| 130 if (!*ok) return this->EmptyExpression(); \ | |
| 131 ((void)0 | |
| 132 #define DUMMY ) // to make indentation work | |
| 133 #undef DUMMY | |
| 134 | |
| 135 // Used in functions where the return type is not ExpressionT. | |
| 136 #define CHECK_OK_CUSTOM(x) ok); \ | 129 #define CHECK_OK_CUSTOM(x) ok); \ |
| 137 if (!*ok) return this->x(); \ | 130 if (!*ok) return this->x(); \ |
| 138 ((void)0 | 131 ((void)0 |
| 139 #define DUMMY ) // to make indentation work | 132 #define DUMMY ) // to make indentation work |
| 140 #undef DUMMY | 133 #undef DUMMY |
| 141 | 134 |
| 135 // Used in functions where the return type is ExpressionT. |
| 136 #define CHECK_OK CHECK_OK_CUSTOM(EmptyExpression) |
| 137 |
| 142 | 138 |
| 143 // Common base class shared between parser and pre-parser. Traits encapsulate | 139 // Common base class shared between parser and pre-parser. Traits encapsulate |
| 144 // the differences between Parser and PreParser: | 140 // the differences between Parser and PreParser: |
| 145 | 141 |
| 146 // - Return types: For example, Parser functions return Expression* and | 142 // - Return types: For example, Parser functions return Expression* and |
| 147 // PreParser functions return PreParserExpression. | 143 // PreParser functions return PreParserExpression. |
| 148 | 144 |
| 149 // - Creating parse tree nodes: Parser generates an AST during the recursive | 145 // - Creating parse tree nodes: Parser generates an AST during the recursive |
| 150 // descent. PreParser doesn't create a tree. Instead, it passes around minimal | 146 // descent. PreParser doesn't create a tree. Instead, it passes around minimal |
| 151 // data objects (PreParserExpression, PreParserIdentifier etc.) which contain | 147 // data objects (PreParserExpression, PreParserIdentifier etc.) which contain |
| (...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3748 has_seen_constructor_ = true; | 3744 has_seen_constructor_ = true; |
| 3749 return; | 3745 return; |
| 3750 } | 3746 } |
| 3751 } | 3747 } |
| 3752 | 3748 |
| 3753 | 3749 |
| 3754 } // namespace internal | 3750 } // namespace internal |
| 3755 } // namespace v8 | 3751 } // namespace v8 |
| 3756 | 3752 |
| 3757 #endif // V8_PARSING_PARSER_BASE_H | 3753 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |