mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 11:27:35 +00:00
LibJS: Switch AST.{h,cpp} to east const
This commit is contained in:
parent
3234697eca
commit
b47246ec70
2 changed files with 84 additions and 84 deletions
|
@ -37,7 +37,7 @@ class InterpreterNodeScope {
|
||||||
AK_MAKE_NONMOVABLE(InterpreterNodeScope);
|
AK_MAKE_NONMOVABLE(InterpreterNodeScope);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InterpreterNodeScope(Interpreter& interpreter, const ASTNode& node)
|
InterpreterNodeScope(Interpreter& interpreter, ASTNode const& node)
|
||||||
: m_interpreter(interpreter)
|
: m_interpreter(interpreter)
|
||||||
, m_chain_node { nullptr, node }
|
, m_chain_node { nullptr, node }
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ String ASTNode::class_name() const
|
||||||
return demangle(typeid(*this).name()).substring(4);
|
return demangle(typeid(*this).name()).substring(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_function_name(Value value, const FlyString& name)
|
static void update_function_name(Value value, FlyString const& name)
|
||||||
{
|
{
|
||||||
if (!value.is_function())
|
if (!value.is_function())
|
||||||
return;
|
return;
|
||||||
|
@ -126,7 +126,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is<MemberExpression>(*m_callee)) {
|
if (is<MemberExpression>(*m_callee)) {
|
||||||
auto& member_expression = static_cast<const MemberExpression&>(*m_callee);
|
auto& member_expression = static_cast<MemberExpression const&>(*m_callee);
|
||||||
Value callee;
|
Value callee;
|
||||||
Object* this_value = nullptr;
|
Object* this_value = nullptr;
|
||||||
|
|
||||||
|
@ -184,9 +184,9 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
|
||||||
if (is<Identifier>(*m_callee) || is<MemberExpression>(*m_callee)) {
|
if (is<Identifier>(*m_callee) || is<MemberExpression>(*m_callee)) {
|
||||||
String expression_string;
|
String expression_string;
|
||||||
if (is<Identifier>(*m_callee)) {
|
if (is<Identifier>(*m_callee)) {
|
||||||
expression_string = static_cast<const Identifier&>(*m_callee).string();
|
expression_string = static_cast<Identifier const&>(*m_callee).string();
|
||||||
} else {
|
} else {
|
||||||
expression_string = static_cast<const MemberExpression&>(*m_callee).to_string_approximation();
|
expression_string = static_cast<MemberExpression const&>(*m_callee).to_string_approximation();
|
||||||
}
|
}
|
||||||
vm.throw_exception<TypeError>(global_object, ErrorType::IsNotAEvaluatedFrom, callee.to_string_without_side_effects(), call_type, expression_string);
|
vm.throw_exception<TypeError>(global_object, ErrorType::IsNotAEvaluatedFrom, callee.to_string_without_side_effects(), call_type, expression_string);
|
||||||
} else {
|
} else {
|
||||||
|
@ -377,10 +377,10 @@ Value ForStatement::execute(Interpreter& interpreter, GlobalObject& global_objec
|
||||||
|
|
||||||
RefPtr<BlockStatement> wrapper;
|
RefPtr<BlockStatement> wrapper;
|
||||||
|
|
||||||
if (m_init && is<VariableDeclaration>(*m_init) && static_cast<const VariableDeclaration&>(*m_init).declaration_kind() != DeclarationKind::Var) {
|
if (m_init && is<VariableDeclaration>(*m_init) && static_cast<VariableDeclaration const&>(*m_init).declaration_kind() != DeclarationKind::Var) {
|
||||||
wrapper = create_ast_node<BlockStatement>(source_range());
|
wrapper = create_ast_node<BlockStatement>(source_range());
|
||||||
NonnullRefPtrVector<VariableDeclaration> decls;
|
NonnullRefPtrVector<VariableDeclaration> decls;
|
||||||
decls.append(*static_cast<const VariableDeclaration*>(m_init.ptr()));
|
decls.append(*static_cast<VariableDeclaration const*>(m_init.ptr()));
|
||||||
wrapper->add_variables(decls);
|
wrapper->add_variables(decls);
|
||||||
interpreter.enter_scope(*wrapper, ScopeType::Block, global_object);
|
interpreter.enter_scope(*wrapper, ScopeType::Block, global_object);
|
||||||
}
|
}
|
||||||
|
@ -449,10 +449,10 @@ Value ForStatement::execute(Interpreter& interpreter, GlobalObject& global_objec
|
||||||
return last_value;
|
return last_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>> variable_from_for_declaration(Interpreter& interpreter, GlobalObject& global_object, const ASTNode& node, RefPtr<BlockStatement> wrapper)
|
static Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>> variable_from_for_declaration(Interpreter& interpreter, GlobalObject& global_object, ASTNode const& node, RefPtr<BlockStatement> wrapper)
|
||||||
{
|
{
|
||||||
if (is<VariableDeclaration>(node)) {
|
if (is<VariableDeclaration>(node)) {
|
||||||
auto& variable_declaration = static_cast<const VariableDeclaration&>(node);
|
auto& variable_declaration = static_cast<VariableDeclaration const&>(node);
|
||||||
VERIFY(!variable_declaration.declarations().is_empty());
|
VERIFY(!variable_declaration.declarations().is_empty());
|
||||||
if (variable_declaration.declaration_kind() != DeclarationKind::Var) {
|
if (variable_declaration.declaration_kind() != DeclarationKind::Var) {
|
||||||
wrapper = create_ast_node<BlockStatement>(node.source_range());
|
wrapper = create_ast_node<BlockStatement>(node.source_range());
|
||||||
|
@ -463,7 +463,7 @@ static Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>> variabl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is<Identifier>(node)) {
|
if (is<Identifier>(node)) {
|
||||||
return NonnullRefPtr(static_cast<const Identifier&>(node));
|
return NonnullRefPtr(static_cast<Identifier const&>(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
@ -1154,7 +1154,7 @@ void BindingPattern::dump(int indent) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionNode::dump(int indent, const String& class_name) const
|
void FunctionNode::dump(int indent, String const& class_name) const
|
||||||
{
|
{
|
||||||
print_indent(indent);
|
print_indent(indent);
|
||||||
outln("{}{} '{}'", class_name, m_is_generator ? "*" : "", name());
|
outln("{}{} '{}'", class_name, m_is_generator ? "*" : "", name());
|
||||||
|
@ -1167,10 +1167,10 @@ void FunctionNode::dump(int indent, const String& class_name) const
|
||||||
if (parameter.is_rest)
|
if (parameter.is_rest)
|
||||||
out("...");
|
out("...");
|
||||||
parameter.binding.visit(
|
parameter.binding.visit(
|
||||||
[&](const FlyString& name) {
|
[&](FlyString const& name) {
|
||||||
outln("{}", name);
|
outln("{}", name);
|
||||||
},
|
},
|
||||||
[&](const BindingPattern& pattern) {
|
[&](BindingPattern const& pattern) {
|
||||||
pattern.dump(indent + 2);
|
pattern.dump(indent + 2);
|
||||||
});
|
});
|
||||||
if (parameter.default_value)
|
if (parameter.default_value)
|
||||||
|
@ -1589,13 +1589,13 @@ Value VariableDeclaration::execute(Interpreter& interpreter, GlobalObject& globa
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
declarator.target().visit(
|
declarator.target().visit(
|
||||||
[&](const NonnullRefPtr<Identifier>& id) {
|
[&](NonnullRefPtr<Identifier> const& id) {
|
||||||
auto variable_name = id->string();
|
auto variable_name = id->string();
|
||||||
if (is<ClassExpression>(*init))
|
if (is<ClassExpression>(*init))
|
||||||
update_function_name(initalizer_result, variable_name);
|
update_function_name(initalizer_result, variable_name);
|
||||||
interpreter.vm().set_variable(variable_name, initalizer_result, global_object, true);
|
interpreter.vm().set_variable(variable_name, initalizer_result, global_object, true);
|
||||||
},
|
},
|
||||||
[&](const NonnullRefPtr<BindingPattern>& pattern) {
|
[&](NonnullRefPtr<BindingPattern> const& pattern) {
|
||||||
interpreter.vm().assign(pattern, initalizer_result, global_object, true);
|
interpreter.vm().assign(pattern, initalizer_result, global_object, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1761,7 @@ PropertyName MemberExpression::computed_property_name(Interpreter& interpreter,
|
||||||
{
|
{
|
||||||
if (!is_computed()) {
|
if (!is_computed()) {
|
||||||
VERIFY(is<Identifier>(*m_property));
|
VERIFY(is<Identifier>(*m_property));
|
||||||
return static_cast<const Identifier&>(*m_property).string();
|
return static_cast<Identifier const&>(*m_property).string();
|
||||||
}
|
}
|
||||||
auto value = m_property->execute(interpreter, global_object);
|
auto value = m_property->execute(interpreter, global_object);
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
|
@ -1774,11 +1774,11 @@ String MemberExpression::to_string_approximation() const
|
||||||
{
|
{
|
||||||
String object_string = "<object>";
|
String object_string = "<object>";
|
||||||
if (is<Identifier>(*m_object))
|
if (is<Identifier>(*m_object))
|
||||||
object_string = static_cast<const Identifier&>(*m_object).string();
|
object_string = static_cast<Identifier const&>(*m_object).string();
|
||||||
if (is_computed())
|
if (is_computed())
|
||||||
return String::formatted("{}[<computed>]", object_string);
|
return String::formatted("{}[<computed>]", object_string);
|
||||||
VERIFY(is<Identifier>(*m_property));
|
VERIFY(is<Identifier>(*m_property));
|
||||||
return String::formatted("{}.{}", object_string, static_cast<const Identifier&>(*m_property).string());
|
return String::formatted("{}.{}", object_string, static_cast<Identifier const&>(*m_property).string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
Value MemberExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const;
|
virtual void generate_bytecode(Bytecode::Generator&) const;
|
||||||
virtual void dump(int indent) const;
|
virtual void dump(int indent) const;
|
||||||
|
|
||||||
const SourceRange& source_range() const { return m_source_range; }
|
SourceRange const& source_range() const { return m_source_range; }
|
||||||
SourceRange& source_range() { return m_source_range; }
|
SourceRange& source_range() { return m_source_range; }
|
||||||
|
|
||||||
String class_name() const;
|
String class_name() const;
|
||||||
|
@ -62,7 +62,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlyString& label() const { return m_label; }
|
FlyString const& label() const { return m_label; }
|
||||||
void set_label(FlyString string) { m_label = string; }
|
void set_label(FlyString string) { m_label = string; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
const Expression& expression() const { return m_expression; };
|
Expression const& expression() const { return m_expression; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NonnullRefPtr<Expression> m_expression;
|
NonnullRefPtr<Expression> m_expression;
|
||||||
|
@ -120,15 +120,15 @@ public:
|
||||||
m_children.append(move(child));
|
m_children.append(move(child));
|
||||||
}
|
}
|
||||||
|
|
||||||
const NonnullRefPtrVector<Statement>& children() const { return m_children; }
|
NonnullRefPtrVector<Statement> const& children() const { return m_children; }
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
void add_variables(NonnullRefPtrVector<VariableDeclaration>);
|
void add_variables(NonnullRefPtrVector<VariableDeclaration>);
|
||||||
void add_functions(NonnullRefPtrVector<FunctionDeclaration>);
|
void add_functions(NonnullRefPtrVector<FunctionDeclaration>);
|
||||||
const NonnullRefPtrVector<VariableDeclaration>& variables() const { return m_variables; }
|
NonnullRefPtrVector<VariableDeclaration> const& variables() const { return m_variables; }
|
||||||
const NonnullRefPtrVector<FunctionDeclaration>& functions() const { return m_functions; }
|
NonnullRefPtrVector<FunctionDeclaration> const& functions() const { return m_functions; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScopeNode(SourceRange source_range)
|
ScopeNode(SourceRange source_range)
|
||||||
|
@ -222,15 +222,15 @@ public:
|
||||||
bool is_rest { false };
|
bool is_rest { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
const FlyString& name() const { return m_name; }
|
FlyString const& name() const { return m_name; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
const Vector<Parameter>& parameters() const { return m_parameters; };
|
Vector<Parameter> const& parameters() const { return m_parameters; };
|
||||||
i32 function_length() const { return m_function_length; }
|
i32 function_length() const { return m_function_length; }
|
||||||
bool is_strict_mode() const { return m_is_strict_mode; }
|
bool is_strict_mode() const { return m_is_strict_mode; }
|
||||||
bool is_generator() const { return m_is_generator; }
|
bool is_generator() const { return m_is_generator; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FunctionNode(const FlyString& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_generator, bool is_strict_mode)
|
FunctionNode(FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_generator, bool is_strict_mode)
|
||||||
: m_name(name)
|
: m_name(name)
|
||||||
, m_body(move(body))
|
, m_body(move(body))
|
||||||
, m_parameters(move(parameters))
|
, m_parameters(move(parameters))
|
||||||
|
@ -241,9 +241,9 @@ protected:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump(int indent, const String& class_name) const;
|
void dump(int indent, String const& class_name) const;
|
||||||
|
|
||||||
const NonnullRefPtrVector<VariableDeclaration>& variables() const { return m_variables; }
|
NonnullRefPtrVector<VariableDeclaration> const& variables() const { return m_variables; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_name(FlyString name)
|
void set_name(FlyString name)
|
||||||
|
@ -255,7 +255,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
FlyString m_name;
|
FlyString m_name;
|
||||||
NonnullRefPtr<Statement> m_body;
|
NonnullRefPtr<Statement> m_body;
|
||||||
const Vector<Parameter> m_parameters;
|
Vector<Parameter> const m_parameters;
|
||||||
NonnullRefPtrVector<VariableDeclaration> m_variables;
|
NonnullRefPtrVector<VariableDeclaration> m_variables;
|
||||||
const i32 m_function_length;
|
const i32 m_function_length;
|
||||||
bool m_is_generator;
|
bool m_is_generator;
|
||||||
|
@ -268,7 +268,7 @@ class FunctionDeclaration final
|
||||||
public:
|
public:
|
||||||
static bool must_have_name() { return true; }
|
static bool must_have_name() { return true; }
|
||||||
|
|
||||||
FunctionDeclaration(SourceRange source_range, const FlyString& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_generator, bool is_strict_mode = false)
|
FunctionDeclaration(SourceRange source_range, FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_generator, bool is_strict_mode = false)
|
||||||
: Declaration(move(source_range))
|
: Declaration(move(source_range))
|
||||||
, FunctionNode(name, move(body), move(parameters), function_length, move(variables), is_generator, is_strict_mode)
|
, FunctionNode(name, move(body), move(parameters), function_length, move(variables), is_generator, is_strict_mode)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ class FunctionExpression final
|
||||||
public:
|
public:
|
||||||
static bool must_have_name() { return false; }
|
static bool must_have_name() { return false; }
|
||||||
|
|
||||||
FunctionExpression(SourceRange source_range, const FlyString& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_generator, bool is_strict_mode, bool is_arrow_function = false)
|
FunctionExpression(SourceRange source_range, FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_generator, bool is_strict_mode, bool is_arrow_function = false)
|
||||||
: Expression(source_range)
|
: Expression(source_range)
|
||||||
, FunctionNode(name, move(body), move(parameters), function_length, move(variables), is_generator, is_strict_mode)
|
, FunctionNode(name, move(body), move(parameters), function_length, move(variables), is_generator, is_strict_mode)
|
||||||
, m_is_arrow_function(is_arrow_function)
|
, m_is_arrow_function(is_arrow_function)
|
||||||
|
@ -329,7 +329,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression* argument() const { return m_argument; }
|
Expression const* argument() const { return m_argument; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -347,7 +347,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression* argument() const { return m_argument; }
|
Expression const* argument() const { return m_argument; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -367,9 +367,9 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& predicate() const { return *m_predicate; }
|
Expression const& predicate() const { return *m_predicate; }
|
||||||
const Statement& consequent() const { return *m_consequent; }
|
Statement const& consequent() const { return *m_consequent; }
|
||||||
const Statement* alternate() const { return m_alternate; }
|
Statement const* alternate() const { return m_alternate; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -390,8 +390,8 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& test() const { return *m_test; }
|
Expression const& test() const { return *m_test; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -411,8 +411,8 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& test() const { return *m_test; }
|
Expression const& test() const { return *m_test; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -432,8 +432,8 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& object() const { return *m_object; }
|
Expression const& object() const { return *m_object; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -454,10 +454,10 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const ASTNode* init() const { return m_init; }
|
ASTNode const* init() const { return m_init; }
|
||||||
const Expression* test() const { return m_test; }
|
Expression const* test() const { return m_test; }
|
||||||
const Expression* update() const { return m_update; }
|
Expression const* update() const { return m_update; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -480,9 +480,9 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const ASTNode& lhs() const { return *m_lhs; }
|
ASTNode const& lhs() const { return *m_lhs; }
|
||||||
const Expression& rhs() const { return *m_rhs; }
|
Expression const& rhs() const { return *m_rhs; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -503,9 +503,9 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const ASTNode& lhs() const { return *m_lhs; }
|
ASTNode const& lhs() const { return *m_lhs; }
|
||||||
const Expression& rhs() const { return *m_rhs; }
|
Expression const& rhs() const { return *m_rhs; }
|
||||||
const Statement& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -733,8 +733,8 @@ public:
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
|
||||||
const String& pattern() const { return m_pattern; }
|
String const& pattern() const { return m_pattern; }
|
||||||
const String& flags() const { return m_flags; }
|
String const& flags() const { return m_flags; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_pattern;
|
String m_pattern;
|
||||||
|
@ -743,13 +743,13 @@ private:
|
||||||
|
|
||||||
class Identifier final : public Expression {
|
class Identifier final : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit Identifier(SourceRange source_range, const FlyString& string)
|
explicit Identifier(SourceRange source_range, FlyString const& string)
|
||||||
: Expression(move(source_range))
|
: Expression(move(source_range))
|
||||||
, m_string(string)
|
, m_string(string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlyString& string() const { return m_string; }
|
FlyString const& string() const { return m_string; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -777,7 +777,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& key() const { return *m_key; }
|
Expression const& key() const { return *m_key; }
|
||||||
Kind kind() const { return m_kind; }
|
Kind kind() const { return m_kind; }
|
||||||
bool is_static() const { return m_is_static; }
|
bool is_static() const { return m_is_static; }
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ private:
|
||||||
ThisAndCallee compute_this_and_callee(Interpreter&, GlobalObject&) const;
|
ThisAndCallee compute_this_and_callee(Interpreter&, GlobalObject&) const;
|
||||||
|
|
||||||
NonnullRefPtr<Expression> m_callee;
|
NonnullRefPtr<Expression> m_callee;
|
||||||
const Vector<Argument> m_arguments;
|
Vector<Argument> const m_arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NewExpression final : public CallExpression {
|
class NewExpression final : public CallExpression {
|
||||||
|
@ -995,7 +995,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& target() const { return m_target; }
|
auto& target() const { return m_target; }
|
||||||
const Expression* init() const { return m_init; }
|
Expression const* init() const { return m_init; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -1020,7 +1020,7 @@ public:
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
const NonnullRefPtrVector<VariableDeclarator>& declarations() const { return m_declarations; }
|
NonnullRefPtrVector<VariableDeclarator> const& declarations() const { return m_declarations; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeclarationKind m_declaration_kind;
|
DeclarationKind m_declaration_kind;
|
||||||
|
@ -1045,8 +1045,8 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& key() const { return m_key; }
|
Expression const& key() const { return m_key; }
|
||||||
const Expression& value() const
|
Expression const& value() const
|
||||||
{
|
{
|
||||||
VERIFY(m_value);
|
VERIFY(m_value);
|
||||||
return *m_value;
|
return *m_value;
|
||||||
|
@ -1089,7 +1089,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vector<RefPtr<Expression>>& elements() const { return m_elements; }
|
Vector<RefPtr<Expression>> const& elements() const { return m_elements; }
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
|
@ -1118,12 +1118,12 @@ public:
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
const NonnullRefPtrVector<Expression>& expressions() const { return m_expressions; }
|
NonnullRefPtrVector<Expression> const& expressions() const { return m_expressions; }
|
||||||
const NonnullRefPtrVector<Expression>& raw_strings() const { return m_raw_strings; }
|
NonnullRefPtrVector<Expression> const& raw_strings() const { return m_raw_strings; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const NonnullRefPtrVector<Expression> m_expressions;
|
NonnullRefPtrVector<Expression> const m_expressions;
|
||||||
const NonnullRefPtrVector<Expression> m_raw_strings;
|
NonnullRefPtrVector<Expression> const m_raw_strings;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TaggedTemplateLiteral final : public Expression {
|
class TaggedTemplateLiteral final : public Expression {
|
||||||
|
@ -1140,8 +1140,8 @@ public:
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const NonnullRefPtr<Expression> m_tag;
|
NonnullRefPtr<Expression> const m_tag;
|
||||||
const NonnullRefPtr<TemplateLiteral> m_template_literal;
|
NonnullRefPtr<TemplateLiteral> const m_template_literal;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MemberExpression final : public Expression {
|
class MemberExpression final : public Expression {
|
||||||
|
@ -1160,8 +1160,8 @@ public:
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
bool is_computed() const { return m_computed; }
|
bool is_computed() const { return m_computed; }
|
||||||
const Expression& object() const { return *m_object; }
|
Expression const& object() const { return *m_object; }
|
||||||
const Expression& property() const { return *m_property; }
|
Expression const& property() const { return *m_property; }
|
||||||
|
|
||||||
PropertyName computed_property_name(Interpreter&, GlobalObject&) const;
|
PropertyName computed_property_name(Interpreter&, GlobalObject&) const;
|
||||||
|
|
||||||
|
@ -1215,15 +1215,15 @@ private:
|
||||||
|
|
||||||
class CatchClause final : public ASTNode {
|
class CatchClause final : public ASTNode {
|
||||||
public:
|
public:
|
||||||
CatchClause(SourceRange source_range, const FlyString& parameter, NonnullRefPtr<BlockStatement> body)
|
CatchClause(SourceRange source_range, FlyString const& parameter, NonnullRefPtr<BlockStatement> body)
|
||||||
: ASTNode(move(source_range))
|
: ASTNode(move(source_range))
|
||||||
, m_parameter(parameter)
|
, m_parameter(parameter)
|
||||||
, m_body(move(body))
|
, m_body(move(body))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlyString& parameter() const { return m_parameter; }
|
FlyString const& parameter() const { return m_parameter; }
|
||||||
const BlockStatement& body() const { return m_body; }
|
BlockStatement const& body() const { return m_body; }
|
||||||
|
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
|
@ -1243,9 +1243,9 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const BlockStatement& block() const { return m_block; }
|
BlockStatement const& block() const { return m_block; }
|
||||||
const CatchClause* handler() const { return m_handler; }
|
CatchClause const* handler() const { return m_handler; }
|
||||||
const BlockStatement* finalizer() const { return m_finalizer; }
|
BlockStatement const* finalizer() const { return m_finalizer; }
|
||||||
|
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
|
@ -1265,7 +1265,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression& argument() const { return m_argument; }
|
Expression const& argument() const { return m_argument; }
|
||||||
|
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
|
@ -1284,8 +1284,8 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expression* test() const { return m_test; }
|
Expression const* test() const { return m_test; }
|
||||||
const NonnullRefPtrVector<Statement>& consequent() const { return m_consequent; }
|
NonnullRefPtrVector<Statement> const& consequent() const { return m_consequent; }
|
||||||
|
|
||||||
virtual void dump(int indent) const override;
|
virtual void dump(int indent) const override;
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
|
@ -1322,7 +1322,7 @@ public:
|
||||||
|
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
|
|
||||||
const FlyString& target_label() const { return m_target_label; }
|
FlyString const& target_label() const { return m_target_label; }
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1340,7 +1340,7 @@ public:
|
||||||
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
virtual Value execute(Interpreter&, GlobalObject&) const override;
|
||||||
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
virtual void generate_bytecode(Bytecode::Generator&) const override;
|
||||||
|
|
||||||
const FlyString& target_label() const { return m_target_label; }
|
FlyString const& target_label() const { return m_target_label; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FlyString m_target_label;
|
FlyString m_target_label;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue