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

Unified Diff: src/ast.h

Issue 477263002: ES6: Add support for method shorthand in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/code-stubs.h » ('j') | no next file with comments »
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 f096c2113cf91ebd7027e32945206948726557fa..7c3efd68ea5b6eb24c102d8d0f93ebc4094146e4 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -2361,11 +2361,11 @@ class FunctionLiteral V8_FINAL : public Expression {
kNotParenthesized
};
- enum KindFlag {
arv (Not doing code reviews) 2014/08/20 22:08:29 I initially added kConciseMethod to this enum but
- kNormalFunction,
- kArrowFunction,
- kGeneratorFunction
- };
+ enum IsGeneratorFlag { kNotGenerator = 0, kIsGenerator = 1 };
+
+ enum IsArrowFlag { kNotArrow = 0, kIsArrow = 1 };
+
+ enum IsConciseMethodFlag { kNotConciseMethod = 0, kIsConciseMethod = 1 };
enum ArityRestriction {
NORMAL_ARITY,
@@ -2458,6 +2458,7 @@ class FunctionLiteral V8_FINAL : public Expression {
bool is_generator() { return IsGenerator::decode(bitfield_); }
bool is_arrow() { return IsArrow::decode(bitfield_); }
+ bool is_concise_method() { return IsConciseMethod::decode(bitfield_); }
int ast_node_count() { return ast_properties_.node_count(); }
AstProperties::Flags* flags() { return ast_properties_.flags(); }
@@ -2481,8 +2482,9 @@ class FunctionLiteral V8_FINAL : public Expression {
int parameter_count, FunctionType function_type,
ParameterFlag has_duplicate_parameters,
IsFunctionFlag is_function,
- IsParenthesizedFlag is_parenthesized, KindFlag kind,
- int position)
+ IsParenthesizedFlag is_parenthesized,
+ IsGeneratorFlag is_generator, IsArrowFlag is_arrow,
+ IsConciseMethodFlag is_concise_method, int position)
: Expression(zone, position),
raw_name_(name),
scope_(scope),
@@ -2500,8 +2502,8 @@ class FunctionLiteral V8_FINAL : public Expression {
HasDuplicateParameters::encode(has_duplicate_parameters) |
IsFunction::encode(is_function) |
IsParenthesized::encode(is_parenthesized) |
- IsGenerator::encode(kind == kGeneratorFunction) |
- IsArrow::encode(kind == kArrowFunction);
+ IsGenerator::encode(is_generator) | IsArrow::encode(is_arrow) |
+ IsConciseMethod::encode(is_concise_method);
}
private:
@@ -2530,6 +2532,7 @@ class FunctionLiteral V8_FINAL : public Expression {
class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {};
class IsGenerator : public BitField<bool, 6, 1> {};
class IsArrow : public BitField<bool, 7, 1> {};
+ class IsConciseMethod : public BitField<bool, 8, 1> {};
};
@@ -3470,12 +3473,14 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
FunctionLiteral::FunctionType function_type,
FunctionLiteral::IsFunctionFlag is_function,
FunctionLiteral::IsParenthesizedFlag is_parenthesized,
- FunctionLiteral::KindFlag kind, int position) {
+ FunctionLiteral::IsGeneratorFlag is_generator,
+ FunctionLiteral::IsArrowFlag is_arrow,
+ FunctionLiteral::IsConciseMethodFlag is_concise_method, int position) {
FunctionLiteral* lit = new (zone_) FunctionLiteral(
zone_, name, ast_value_factory, scope, body, materialized_literal_count,
expected_property_count, handler_count, parameter_count, function_type,
- has_duplicate_parameters, is_function, is_parenthesized, kind,
- position);
+ has_duplicate_parameters, is_function, is_parenthesized, is_generator,
+ is_arrow, is_concise_method, 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/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698