Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: src/ast.h

Issue 160073006: Implement handling of arrow functions in the parser (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implement handling of arrow functions in the parser Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index c6ee71ed83ed613ab121f2f9b80fdc9712f619b7..cdc8e70e5ad9f9d88e1006cb4c201013b0cfcf1f 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -2309,6 +2309,11 @@ class FunctionLiteral V8_FINAL : public Expression {
kNotGenerator
};
+ enum IsArrowFlag {
+ kIsArrow,
+ kNotArrow
+ };
+
DECLARE_NODE_TYPE(FunctionLiteral)
Handle<String> name() const { return name_; }
@@ -2371,6 +2376,10 @@ class FunctionLiteral V8_FINAL : public Expression {
return IsGenerator::decode(bitfield_) == kIsGenerator;
}
+ bool is_arrow() {
+ return IsArrow::decode(bitfield_) == kIsArrow;
+ }
+
int ast_node_count() { return ast_properties_.node_count(); }
AstProperties::Flags* flags() { return ast_properties_.flags(); }
void set_ast_properties(AstProperties* ast_properties) {
@@ -2405,6 +2414,7 @@ class FunctionLiteral V8_FINAL : public Expression {
IsFunctionFlag is_function,
IsParenthesizedFlag is_parenthesized,
IsGeneratorFlag is_generator,
+ IsArrowFlag is_arrow,
int position)
: Expression(zone, position),
name_(name),
@@ -2424,7 +2434,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(is_generator) |
+ IsArrow::encode(is_arrow);
}
private:
@@ -2451,6 +2462,7 @@ class FunctionLiteral V8_FINAL : public Expression {
class IsFunction: public BitField<IsFunctionFlag, 4, 1> {};
class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {};
class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {};
+ class IsArrow: public BitField<IsArrowFlag, 7, 1> {};
};
@@ -3333,12 +3345,13 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
FunctionLiteral::IsFunctionFlag is_function,
FunctionLiteral::IsParenthesizedFlag is_parenthesized,
FunctionLiteral::IsGeneratorFlag is_generator,
+ FunctionLiteral::IsArrowFlag is_arrow,
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, is_generator, is_arrow, position);
// Top-level literal doesn't count for the AST's properties.
if (is_function == FunctionLiteral::kIsFunction) {
visitor_.VisitFunctionLiteral(lit);
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698