Index: src/parsing/preparser.h |
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h |
index 0bac1277b048ff62fcf17febeecd0f7d7e77d32a..331c91f203784a2ccdea5c6d3d0220dcbe6ad1f3 100644 |
--- a/src/parsing/preparser.h |
+++ b/src/parsing/preparser.h |
@@ -662,7 +662,7 @@ class PreParserFactory { |
FunctionLiteral::ParameterFlag has_duplicate_parameters, |
FunctionLiteral::FunctionType function_type, |
FunctionLiteral::EagerCompileHint eager_compile_hint, int position, |
- bool has_braces) { |
+ bool has_braces, int function_literal_id) { |
return PreParserExpression::Default(); |
} |
@@ -1080,10 +1080,33 @@ class PreParser : public ParserBase<PreParser> { |
int class_token_pos, bool* ok) {} |
V8_INLINE void DeclareClassProperty(PreParserIdentifier class_name, |
PreParserExpression property, |
- ClassInfo* class_info, bool* ok) {} |
+ ClassLiteralProperty::Kind kind, |
+ bool is_static, ClassInfo* class_info, |
+ bool* ok) { |
+ if (class_info->has_seen_constructor && |
marja
2016/11/25 13:14:56
This function could still use a comment... as far
jochen (gone - plz use gerrit)
2016/11/28 08:12:07
I guess the contract of DeclareClassProperty is ju
|
+ !class_info->constructor.IsEmpty()) { |
+ // We use Empty to differentiate an existing constructor from Default |
+ // which encodes the absence of a constructor. |
+ class_info->constructor = PreParserExpression::Empty(); |
+ return; |
+ } |
+ if (kind == ClassLiteralProperty::FIELD && !is_static) { |
+ class_info->instance_field_initializers->Add( |
+ PreParserExpression::Default(), zone()); |
+ } |
+ } |
V8_INLINE PreParserExpression RewriteClassLiteral(PreParserIdentifier name, |
ClassInfo* class_info, |
int pos, bool* ok) { |
+ bool has_default_constructor = !class_info->has_seen_constructor; |
+ bool has_instance_fields = |
+ class_info->instance_field_initializers->length() > 0; |
+ // Account for the default constructor. |
+ if (has_default_constructor) GetNextFunctionLiteralId(); |
Toon Verwaest
2016/11/28 11:12:33
Do we really need an ID for the default constructo
jochen (gone - plz use gerrit)
2016/11/28 11:26:50
they get lazily compiled, so they end up in the SF
|
+ if (allow_harmony_class_fields() && has_instance_fields) { |
+ // Account for initializer function. |
Toon Verwaest
2016/11/28 11:12:33
Can we e.g., put breakpoints in the initializer by
|
+ GetNextFunctionLiteralId(); |
+ } |
return PreParserExpression::Default(); |
} |