Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 0115d988272c44e64f326d6f7377619824f2ea41..73d861c07f1e1067a0b48b1b00b09cc39d869944 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -2287,9 +2287,10 @@ class FunctionLiteral V8_FINAL : public Expression { |
kNotParenthesized |
}; |
- enum IsGeneratorFlag { |
- kIsGenerator, |
- kNotGenerator |
+ enum KindFlag { |
+ kNormalFunction, |
+ kArrowFunction, |
+ kGeneratorFunction |
}; |
DECLARE_NODE_TYPE(FunctionLiteral) |
@@ -2350,9 +2351,8 @@ class FunctionLiteral V8_FINAL : public Expression { |
bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized); |
} |
- bool is_generator() { |
- return IsGenerator::decode(bitfield_) == kIsGenerator; |
- } |
+ bool is_generator() { return IsGenerator::decode(bitfield_); } |
+ bool is_arrow() { return IsArrow::decode(bitfield_); } |
int ast_node_count() { return ast_properties_.node_count(); } |
AstProperties::Flags* flags() { return ast_properties_.flags(); } |
@@ -2381,7 +2381,7 @@ class FunctionLiteral V8_FINAL : public Expression { |
ParameterFlag has_duplicate_parameters, |
IsFunctionFlag is_function, |
IsParenthesizedFlag is_parenthesized, |
- IsGeneratorFlag is_generator, |
+ KindFlag kind, |
int position) |
: Expression(zone, position), |
name_(name), |
@@ -2401,7 +2401,8 @@ class FunctionLiteral V8_FINAL : public Expression { |
HasDuplicateParameters::encode(has_duplicate_parameters) | |
IsFunction::encode(is_function) | |
IsParenthesized::encode(is_parenthesized) | |
- IsGenerator::encode(is_generator); |
+ IsGenerator::encode(kind == kGeneratorFunction) | |
+ IsArrow::encode(kind == kArrowFunction); |
} |
private: |
@@ -2426,7 +2427,8 @@ class FunctionLiteral V8_FINAL : public Expression { |
class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; |
class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; |
class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; |
- class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; |
+ class IsGenerator: public BitField<bool, 6, 1> {}; |
+ class IsArrow: public BitField<bool, 7, 1> {}; |
}; |
@@ -3303,13 +3305,13 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
FunctionLiteral::FunctionType function_type, |
FunctionLiteral::IsFunctionFlag is_function, |
FunctionLiteral::IsParenthesizedFlag is_parenthesized, |
- FunctionLiteral::IsGeneratorFlag is_generator, |
+ FunctionLiteral::KindFlag kind, |
int position) { |
FunctionLiteral* lit = new(zone_) FunctionLiteral( |
zone_, name, scope, body, |
materialized_literal_count, expected_property_count, handler_count, |
parameter_count, function_type, has_duplicate_parameters, is_function, |
- is_parenthesized, is_generator, position); |
+ is_parenthesized, kind, position); |
// Top-level literal doesn't count for the AST's properties. |
if (is_function == FunctionLiteral::kIsFunction) { |
visitor_.VisitFunctionLiteral(lit); |