Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 5e37d632fdb8bffbf9e767da466a1eff34ec3c1e..46adbdbe372441524cf3977f8f932323b9c6163f 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -510,11 +510,10 @@ class ParserBase : public Traits { |
bool* is_static, bool* is_computed_name, |
bool* ok); |
ExpressionT ParseObjectLiteral(bool* ok); |
- ObjectLiteralPropertyT ParsePropertyDefinition(ObjectLiteralChecker* checker, |
- bool in_class, bool is_static, |
- bool* is_computed_name, |
- bool* has_seen_constructor, |
- bool* ok); |
+ ObjectLiteralPropertyT ParsePropertyDefinition( |
+ ObjectLiteralChecker* checker, bool in_class, bool has_extends, |
+ bool is_static, bool* is_computed_name, bool* has_seen_constructor, |
+ bool* ok); |
typename Traits::Type::ExpressionList ParseArguments(bool* ok); |
ExpressionT ParseAssignmentExpression(bool accept_IN, bool* ok); |
ExpressionT ParseYieldExpression(bool* ok); |
@@ -1301,7 +1300,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); |
} |
@@ -2067,7 +2067,8 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
template <class Traits> |
typename ParserBase<Traits>::ObjectLiteralPropertyT |
ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralChecker* checker, |
- bool in_class, bool is_static, |
+ bool in_class, bool has_extends, |
+ bool is_static, |
bool* is_computed_name, |
bool* has_seen_constructor, |
bool* ok) { |
@@ -2126,7 +2127,8 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralChecker* checker, |
} |
*has_seen_constructor = true; |
- kind = FunctionKind::kNormalFunction; |
+ kind = has_extends ? FunctionKind::kSubclassConstructor |
+ : FunctionKind::kNormalFunction; |
} |
if (!*is_computed_name && checker != NULL) { |
@@ -2147,8 +2149,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, has_extends, true, |
+ is_computed_name, nullptr, ok); |
} else if (is_get || is_set) { |
// Accessor |
@@ -2240,9 +2242,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, has_extends, is_static, &is_computed_name, NULL, |
+ CHECK_OK); |
if (is_computed_name) { |
has_computed_names = true; |