mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
LibJS: Refactor parse_function_node() bool parameters into bit flags
I'm about to add even more options and a bunch of unnamed true/false arguments is really not helpful. Let's make this a single parse options parameter using bit flags.
This commit is contained in:
parent
50f8f27ac6
commit
db75be1119
2 changed files with 20 additions and 15 deletions
|
@ -40,6 +40,14 @@ enum class Associativity {
|
|||
Right
|
||||
};
|
||||
|
||||
struct FunctionNodeParseOptions {
|
||||
enum {
|
||||
CheckForFunctionAndName = 1 << 0,
|
||||
AllowSuperPropertyLookup = 1 << 1,
|
||||
AllowSuperConstructorCall = 1 << 2,
|
||||
};
|
||||
};
|
||||
|
||||
class Parser {
|
||||
public:
|
||||
explicit Parser(Lexer lexer);
|
||||
|
@ -47,7 +55,7 @@ public:
|
|||
NonnullRefPtr<Program> parse_program();
|
||||
|
||||
template<typename FunctionNodeType>
|
||||
NonnullRefPtr<FunctionNodeType> parse_function_node(bool check_for_function_and_name = true, bool allow_super_property_lookup = false, bool allow_super_constructor_call = false);
|
||||
NonnullRefPtr<FunctionNodeType> parse_function_node(u8 parse_options = FunctionNodeParseOptions::CheckForFunctionAndName);
|
||||
Vector<FunctionNode::Parameter> parse_function_parameters(int& function_length);
|
||||
|
||||
NonnullRefPtr<Statement> parse_statement();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue