parsing.h 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_PARSING_PARSING_H_
#define V8_PARSING_PARSING_H_

#include "src/globals.h"

namespace v8 {
namespace internal {

class ParseInfo;
14
class SharedFunctionInfo;
15 16 17 18 19

namespace parsing {

// Parses the top-level source code represented by the parse info and sets its
// function literal.  Returns false (and deallocates any allocated AST
20 21
// nodes) if parsing failed.
V8_EXPORT_PRIVATE bool ParseProgram(ParseInfo* info, Isolate* isolate);
22

23
// Like ParseProgram but for an individual function which already has a
24
// allocated shared function info.
25 26
V8_EXPORT_PRIVATE bool ParseFunction(ParseInfo* info,
                                     Handle<SharedFunctionInfo> shared_info,
27
                                     Isolate* isolate);
28 29 30

// If you don't know whether info->is_toplevel() is true or not, use this method
// to dispatch to either of the above functions. Prefer to use the above methods
31
// whenever possible.
32 33
V8_EXPORT_PRIVATE bool ParseAny(ParseInfo* info,
                                Handle<SharedFunctionInfo> shared_info,
34
                                Isolate* isolate);
35 36 37 38 39 40

}  // namespace parsing
}  // namespace internal
}  // namespace v8

#endif  // V8_PARSING_PARSING_H_