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

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: Add strict formal param checking 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
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 2c8d799c2e68ad55900a344a540bf646a21a2552..f26d9f6efb71310ffa93fdd6eab30474bf4db45d 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -2367,11 +2367,11 @@ class FunctionLiteral V8_FINAL : public Expression {
kNotParenthesized
};
- enum KindFlag {
- 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,
@@ -2464,6 +2464,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(); }
@@ -2487,8 +2488,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),
@@ -2506,8 +2508,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:
@@ -2536,6 +2538,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> {};
};
@@ -3476,12 +3479,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 | « src/arm64/lithium-codegen-arm64.cc ('k') | src/code-stubs.h » ('j') | src/parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698