aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/torque/ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/torque/ast.h')
-rw-r--r--deps/v8/src/torque/ast.h74
1 files changed, 44 insertions, 30 deletions
diff --git a/deps/v8/src/torque/ast.h b/deps/v8/src/torque/ast.h
index d9bb71a663..6bd4d79096 100644
--- a/deps/v8/src/torque/ast.h
+++ b/deps/v8/src/torque/ast.h
@@ -30,7 +30,9 @@ namespace torque {
V(ElementAccessExpression) \
V(AssignmentExpression) \
V(IncrementDecrementExpression) \
- V(AssumeTypeImpossibleExpression)
+ V(AssumeTypeImpossibleExpression) \
+ V(StatementExpression) \
+ V(TryLabelExpression)
#define AST_TYPE_EXPRESSION_NODE_KIND_LIST(V) \
V(BasicTypeExpression) \
@@ -52,7 +54,6 @@ namespace torque {
V(TailCallStatement) \
V(VarDeclarationStatement) \
V(GotoStatement) \
- V(TryLabelStatement)
#define AST_DECLARATION_NODE_KIND_LIST(V) \
V(TypeDeclaration) \
@@ -90,7 +91,7 @@ struct AstNode {
};
AstNode(Kind kind, SourcePosition pos) : kind(kind), pos(pos) {}
- virtual ~AstNode() {}
+ virtual ~AstNode() = default;
const Kind kind;
SourcePosition pos;
@@ -171,7 +172,7 @@ struct DefaultModuleDeclaration : ModuleDeclaration {
DEFINE_AST_NODE_LEAF_BOILERPLATE(DefaultModuleDeclaration)
DefaultModuleDeclaration(SourcePosition pos,
std::vector<Declaration*> declarations)
- : ModuleDeclaration(kKind, pos, declarations) {}
+ : ModuleDeclaration(kKind, pos, std::move(declarations)) {}
bool IsDefault() const override { return true; }
};
@@ -179,7 +180,8 @@ struct ExplicitModuleDeclaration : ModuleDeclaration {
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExplicitModuleDeclaration)
ExplicitModuleDeclaration(SourcePosition pos, std::string name,
std::vector<Declaration*> declarations)
- : ModuleDeclaration(kKind, pos, declarations), name(std::move(name)) {}
+ : ModuleDeclaration(kKind, pos, std::move(declarations)),
+ name(std::move(name)) {}
bool IsDefault() const override { return false; }
std::string name;
};
@@ -228,7 +230,7 @@ struct CallExpression : Expression {
callee(pos, std::move(callee), std::move(generic_arguments)),
is_operator(is_operator),
arguments(std::move(arguments)),
- labels(labels) {}
+ labels(std::move(labels)) {}
IdentifierExpression callee;
bool is_operator;
std::vector<Expression*> arguments;
@@ -240,7 +242,7 @@ struct StructExpression : Expression {
StructExpression(SourcePosition pos, std::string name,
std::vector<Expression*> expressions)
: Expression(kKind, pos),
- name(name),
+ name(std::move(name)),
expressions(std::move(expressions)) {}
std::string name;
std::vector<Expression*> expressions;
@@ -362,7 +364,9 @@ struct ParameterList {
struct BasicTypeExpression : TypeExpression {
DEFINE_AST_NODE_LEAF_BOILERPLATE(BasicTypeExpression)
BasicTypeExpression(SourcePosition pos, bool is_constexpr, std::string name)
- : TypeExpression(kKind, pos), is_constexpr(is_constexpr), name(name) {}
+ : TypeExpression(kKind, pos),
+ is_constexpr(is_constexpr),
+ name(std::move(name)) {}
bool is_constexpr;
std::string name;
};
@@ -373,7 +377,7 @@ struct FunctionTypeExpression : TypeExpression {
std::vector<TypeExpression*> parameters,
TypeExpression* return_type)
: TypeExpression(kKind, pos),
- parameters(parameters),
+ parameters(std::move(parameters)),
return_type(return_type) {}
std::vector<TypeExpression*> parameters;
TypeExpression* return_type;
@@ -550,15 +554,22 @@ struct LabelBlock : AstNode {
Statement* body;
};
-struct TryLabelStatement : Statement {
- DEFINE_AST_NODE_LEAF_BOILERPLATE(TryLabelStatement)
- TryLabelStatement(SourcePosition pos, Statement* try_block,
- std::vector<LabelBlock*> label_blocks)
- : Statement(kKind, pos),
- try_block(try_block),
- label_blocks(std::move(label_blocks)) {}
- Statement* try_block;
- std::vector<LabelBlock*> label_blocks;
+struct StatementExpression : Expression {
+ DEFINE_AST_NODE_LEAF_BOILERPLATE(StatementExpression)
+ StatementExpression(SourcePosition pos, Statement* statement)
+ : Expression(kKind, pos), statement(statement) {}
+ Statement* statement;
+};
+
+struct TryLabelExpression : Expression {
+ DEFINE_AST_NODE_LEAF_BOILERPLATE(TryLabelExpression)
+ TryLabelExpression(SourcePosition pos, Expression* try_expression,
+ LabelBlock* label_block)
+ : Expression(kKind, pos),
+ try_expression(try_expression),
+ label_block(label_block) {}
+ Expression* try_expression;
+ LabelBlock* label_block;
};
struct BlockStatement : Statement {
@@ -634,7 +645,8 @@ struct MacroDeclaration : CallableNode {
base::Optional<std::string> op, ParameterList parameters,
TypeExpression* return_type,
const LabelAndTypesVector& labels)
- : CallableNode(kind, pos, name, parameters, return_type, labels),
+ : CallableNode(kind, pos, std::move(name), std::move(parameters),
+ return_type, labels),
op(std::move(op)) {}
base::Optional<std::string> op;
};
@@ -646,8 +658,8 @@ struct ExternalMacroDeclaration : MacroDeclaration {
ParameterList parameters,
TypeExpression* return_type,
const LabelAndTypesVector& labels)
- : MacroDeclaration(kKind, pos, name, op, parameters, return_type,
- labels) {}
+ : MacroDeclaration(kKind, pos, std::move(name), std::move(op),
+ std::move(parameters), return_type, labels) {}
};
struct TorqueMacroDeclaration : MacroDeclaration {
@@ -656,15 +668,16 @@ struct TorqueMacroDeclaration : MacroDeclaration {
base::Optional<std::string> op,
ParameterList parameters, TypeExpression* return_type,
const LabelAndTypesVector& labels)
- : MacroDeclaration(kKind, pos, name, op, parameters, return_type,
- labels) {}
+ : MacroDeclaration(kKind, pos, std::move(name), std::move(op),
+ std::move(parameters), return_type, labels) {}
};
struct BuiltinDeclaration : CallableNode {
BuiltinDeclaration(AstNode::Kind kind, SourcePosition pos,
bool javascript_linkage, std::string name,
ParameterList parameters, TypeExpression* return_type)
- : CallableNode(kind, pos, name, parameters, return_type, {}),
+ : CallableNode(kind, pos, std::move(name), std::move(parameters),
+ return_type, {}),
javascript_linkage(javascript_linkage) {}
bool javascript_linkage;
};
@@ -674,8 +687,8 @@ struct ExternalBuiltinDeclaration : BuiltinDeclaration {
ExternalBuiltinDeclaration(SourcePosition pos, bool javascript_linkage,
std::string name, ParameterList parameters,
TypeExpression* return_type)
- : BuiltinDeclaration(kKind, pos, javascript_linkage, name, parameters,
- return_type) {}
+ : BuiltinDeclaration(kKind, pos, javascript_linkage, std::move(name),
+ std::move(parameters), return_type) {}
};
struct TorqueBuiltinDeclaration : BuiltinDeclaration {
@@ -683,8 +696,8 @@ struct TorqueBuiltinDeclaration : BuiltinDeclaration {
TorqueBuiltinDeclaration(SourcePosition pos, bool javascript_linkage,
std::string name, ParameterList parameters,
TypeExpression* return_type)
- : BuiltinDeclaration(kKind, pos, javascript_linkage, name, parameters,
- return_type) {}
+ : BuiltinDeclaration(kKind, pos, javascript_linkage, std::move(name),
+ std::move(parameters), return_type) {}
};
struct ExternalRuntimeDeclaration : CallableNode {
@@ -741,8 +754,9 @@ struct SpecializationDeclaration : Declaration {
: Declaration(kKind, pos),
name(std::move(name)),
external(false),
- generic_parameters(generic_parameters),
- signature(new CallableNodeSignature{parameters, return_type, labels}),
+ generic_parameters(std::move(generic_parameters)),
+ signature(new CallableNodeSignature{std::move(parameters), return_type,
+ std::move(labels)}),
body(b) {}
std::string name;
bool external;