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

Unified Diff: src/ast.h

Issue 615043002: Desugar 'super(..)' into 'super.constructor(...)' (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months 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 | « no previous file | test/mjsunit/harmony/super.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 80be15892e6cb0578cf65341d889164bab7c994e..f695e1233340d274df2b5aff68398c2623857c31 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -3390,7 +3390,16 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
Call* NewCall(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
- Call* call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_);
+ SuperReference* super_ref = expression->AsSuperReference();
+ Call* call;
+ if (super_ref != NULL) {
+ Literal* constructor =
+ NewStringLiteral(ast_value_factory_->constructor_string(), pos);
+ Property* superConstructor = NewProperty(super_ref, constructor, pos);
+ call = new (zone_) Call(zone_, superConstructor, arguments, pos, id_gen_);
+ } else {
+ call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_);
+ }
VISIT_AND_RETURN(Call, call)
}
« no previous file with comments | « no previous file | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698