| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_PARSING_H_ | 5 #ifndef V8_PARSING_PARSING_H_ |
| 6 #define V8_PARSING_PARSING_H_ | 6 #define V8_PARSING_PARSING_H_ |
| 7 | 7 |
| 8 #include "src/globals.h" | 8 #include "src/globals.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 class ParseInfo; | 13 class ParseInfo; |
| 14 | 14 |
| 15 namespace parsing { | 15 namespace parsing { |
| 16 | 16 |
| 17 // Parses the top-level source code represented by the parse info and sets its | 17 // Parses the top-level source code represented by the parse info and sets its |
| 18 // function literal. Returns false (and deallocates any allocated AST | 18 // function literal. Returns false (and deallocates any allocated AST |
| 19 // nodes) if parsing failed. | 19 // nodes) if parsing failed. Internalizes AST nodes on the heap if |
| 20 V8_EXPORT_PRIVATE bool ParseProgram(ParseInfo* info); | 20 // |internalize|. |
| 21 V8_EXPORT_PRIVATE bool ParseProgram(ParseInfo* info, bool internalize = true); |
| 21 | 22 |
| 22 // Like ParseProgram but for an individual function. | 23 // Like ParseProgram but for an individual function. Internalizes AST nodes on |
| 23 V8_EXPORT_PRIVATE bool ParseFunction(ParseInfo* info); | 24 // the heap if |internalize|. |
| 25 V8_EXPORT_PRIVATE bool ParseFunction(ParseInfo* info, bool internalize = true); |
| 24 | 26 |
| 25 // If you don't know whether info->is_toplevel() is true or not, use this method | 27 // If you don't know whether info->is_toplevel() is true or not, use this method |
| 26 // to dispatch to either of the above functions. Prefer to use the above methods | 28 // to dispatch to either of the above functions. Prefer to use the above methods |
| 27 // whenever possible. | 29 // whenever possible. Internalizes AST nodes on the heap if |internalize|. |
| 28 V8_EXPORT_PRIVATE bool ParseAny(ParseInfo* info); | 30 V8_EXPORT_PRIVATE bool ParseAny(ParseInfo* info, bool internalize = true); |
| 29 | 31 |
| 30 } // namespace parsing | 32 } // namespace parsing |
| 31 } // namespace internal | 33 } // namespace internal |
| 32 } // namespace v8 | 34 } // namespace v8 |
| 33 | 35 |
| 34 #endif // V8_PARSING_PARSING_H_ | 36 #endif // V8_PARSING_PARSING_H_ |
| OLD | NEW |