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

Unified Diff: src/parser.cc

Issue 703603005: Classes: Fix issue with default constructor crash (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Trying... Created 6 years, 1 month 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
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 7a88c5270da7ddc02f0564b2cfb91e1085cbe7fd..cdda832aedfe9983657a8647bb22204b9a551f9d 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -648,6 +648,45 @@ Expression* ParserTraits::ClassExpression(
start_position, end_position);
}
+
+Expression* ParserTraits::DefaultConstructor(
+ bool call_super, Scope* scope,
+ AstNodeFactory<AstConstructionVisitor>* factory) {
+ Scope* function_scope = NewScope(scope, FUNCTION_SCOPE);
+ // Set position and force eager compilation since lazy parsing tries to
+ // parse the content which does not exist.
+ function_scope->set_start_position(0);
+ function_scope->set_end_position(0);
+ // function_scope->SetScopeName(name);
+ function_scope->ForceEagerCompilation();
+
+ int pos = RelocInfo::kNoPosition;
+
+ Zone* zone = parser_->zone();
+ ZoneList<Statement*>* body = new (zone) ZoneList<Statement*>(1, zone);
+ if (call_super) {
+ Expression* prop = SuperReference(function_scope, factory, pos);
+ ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(0, zone);
+ Expression* call_expression = factory->NewCall(prop, args, pos);
+ body->Add(factory->NewExpressionStatement(call_expression, pos), zone);
+ }
+
+ int materialized_literal_count = 0;
+ int expected_property_count = 0;
+ int handler_count = 0;
+ int parameter_count = 0;
+
+ const AstRawString* name = ast_value_factory()->empty_string();
+
+ return factory->NewFunctionLiteral(
+ name, ast_value_factory(), function_scope, body,
+ materialized_literal_count, expected_property_count, handler_count,
+ parameter_count, FunctionLiteral::kNoDuplicateParameters,
+ FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction,
+ FunctionLiteral::kNotParenthesized, FunctionKind::kNormalFunction, pos);
+}
+
+
Literal* ParserTraits::ExpressionFromLiteral(
Token::Value token, int pos,
Scanner* scanner,
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698