Chromium Code Reviews| Index: src/preparser.h |
| diff --git a/src/preparser.h b/src/preparser.h |
| index 5e37d632fdb8bffbf9e767da466a1eff34ec3c1e..9b6e056d404be450822f7185b3c666d0fba44042 100644 |
| --- a/src/preparser.h |
| +++ b/src/preparser.h |
| @@ -512,6 +512,7 @@ class ParserBase : public Traits { |
| ExpressionT ParseObjectLiteral(bool* ok); |
| ObjectLiteralPropertyT ParsePropertyDefinition(ObjectLiteralChecker* checker, |
| bool in_class, bool is_static, |
| + bool has_extends, |
|
arv (Not doing code reviews)
2015/01/24 16:19:09
I would prefer has_extends before is_static since
Dmitry Lomov (no reviews)
2015/01/26 23:34:04
Done.
|
| bool* is_computed_name, |
| bool* has_seen_constructor, |
| bool* ok); |
| @@ -1301,7 +1302,8 @@ class PreParserTraits { |
| const char* type, Handle<Object> arg, int pos) { |
| return PreParserExpression::Default(); |
| } |
| - PreParserScope NewScope(PreParserScope* outer_scope, ScopeType scope_type) { |
| + PreParserScope NewScope(PreParserScope* outer_scope, ScopeType scope_type, |
| + FunctionKind kind = kNormalFunction) { |
| return PreParserScope(outer_scope, scope_type); |
| } |
| @@ -2068,6 +2070,7 @@ template <class Traits> |
| typename ParserBase<Traits>::ObjectLiteralPropertyT |
| ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralChecker* checker, |
| bool in_class, bool is_static, |
| + bool has_extends, |
| bool* is_computed_name, |
| bool* has_seen_constructor, |
| bool* ok) { |
| @@ -2126,7 +2129,8 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralChecker* checker, |
| } |
| *has_seen_constructor = true; |
| - kind = FunctionKind::kNormalFunction; |
| + kind = has_extends ? FunctionKind::kSubclassConstructor |
|
arv (Not doing code reviews)
2015/01/23 21:37:00
Sad. This needs to be dynamic since an extends val
Dmitry Lomov (no reviews)
2015/01/24 02:45:14
That is fine. FunctionKind::kSubclassConstructor m
arv (Not doing code reviews)
2015/01/24 16:19:09
Resolved.
has_extends is just an optimization the
Dmitry Lomov (no reviews)
2015/01/26 23:34:04
Yes, correct. Most importantly, normal functions a
|
| + : FunctionKind::kNormalFunction; |
| } |
| if (!*is_computed_name && checker != NULL) { |
| @@ -2147,8 +2151,8 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralChecker* checker, |
| } else if (in_class && name_is_static && !is_static) { |
| // static MethodDefinition |
| - return ParsePropertyDefinition(checker, true, true, is_computed_name, NULL, |
| - ok); |
| + return ParsePropertyDefinition(checker, true, true, has_extends, |
| + is_computed_name, nullptr, ok); |
| } else if (is_get || is_set) { |
| // Accessor |
| @@ -2240,9 +2244,11 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral( |
| const bool in_class = false; |
| const bool is_static = false; |
| + const bool has_extends = false; |
| bool is_computed_name = false; |
| ObjectLiteralPropertyT property = this->ParsePropertyDefinition( |
| - &checker, in_class, is_static, &is_computed_name, NULL, CHECK_OK); |
| + &checker, in_class, is_static, has_extends, &is_computed_name, NULL, |
| + CHECK_OK); |
| if (is_computed_name) { |
| has_computed_names = true; |