Chromium Code Reviews| Index: src/parser.cc |
| diff --git a/src/parser.cc b/src/parser.cc |
| index 7a88c5270da7ddc02f0564b2cfb91e1085cbe7fd..120bd68ce343f35300ccdfa246318b45e05c72d0 100644 |
| --- a/src/parser.cc |
| +++ b/src/parser.cc |
| @@ -644,10 +644,23 @@ Expression* ParserTraits::ClassExpression( |
| const AstRawString* name, Expression* extends, Expression* constructor, |
| ZoneList<ObjectLiteral::Property*>* properties, int start_position, |
| int end_position, AstNodeFactory<AstConstructionVisitor>* factory) { |
| + if (constructor == NULL) { |
| + // Create default constructor. |
| + Scope* scope = NewScope(parser_->scope_, FUNCTION_SCOPE); |
| + // Set position and force eager compilation since lazy parsing tries to |
|
arv (Not doing code reviews)
2014/11/04 17:53:05
This is not very good. Suggestions welcome.
Dmitry Lomov (no reviews)
2014/11/04 18:06:07
I believe we need a new kind of function: a flag o
|
| + // parse the content which does not exist. |
| + scope->set_start_position(0); |
| + scope->set_end_position(0); |
| + scope->SetScopeName(name); |
| + scope->ForceEagerCompilation(); |
| + constructor = factory->NewDefaultConstructor(name, ast_value_factory(), |
| + scope, RelocInfo::kNoPosition); |
| + } |
| return factory->NewClassLiteral(name, extends, constructor, properties, |
| start_position, end_position); |
| } |
| + |
| Literal* ParserTraits::ExpressionFromLiteral( |
| Token::Value token, int pos, |
| Scanner* scanner, |