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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/harmony/super.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 } 3383 }
3384 3384
3385 Property* NewProperty(Expression* obj, Expression* key, int pos) { 3385 Property* NewProperty(Expression* obj, Expression* key, int pos) {
3386 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_); 3386 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_);
3387 VISIT_AND_RETURN(Property, prop) 3387 VISIT_AND_RETURN(Property, prop)
3388 } 3388 }
3389 3389
3390 Call* NewCall(Expression* expression, 3390 Call* NewCall(Expression* expression,
3391 ZoneList<Expression*>* arguments, 3391 ZoneList<Expression*>* arguments,
3392 int pos) { 3392 int pos) {
3393 Call* call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_); 3393 SuperReference* super_ref = expression->AsSuperReference();
3394 Call* call;
3395 if (super_ref != NULL) {
3396 Literal* constructor =
3397 NewStringLiteral(ast_value_factory_->constructor_string(), pos);
3398 Property* superConstructor = NewProperty(super_ref, constructor, pos);
3399 call = new (zone_) Call(zone_, superConstructor, arguments, pos, id_gen_);
3400 } else {
3401 call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_);
3402 }
3394 VISIT_AND_RETURN(Call, call) 3403 VISIT_AND_RETURN(Call, call)
3395 } 3404 }
3396 3405
3397 CallNew* NewCallNew(Expression* expression, 3406 CallNew* NewCallNew(Expression* expression,
3398 ZoneList<Expression*>* arguments, 3407 ZoneList<Expression*>* arguments,
3399 int pos) { 3408 int pos) {
3400 CallNew* call = 3409 CallNew* call =
3401 new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_); 3410 new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_);
3402 VISIT_AND_RETURN(CallNew, call) 3411 VISIT_AND_RETURN(CallNew, call)
3403 } 3412 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 Zone* zone_; 3544 Zone* zone_;
3536 Visitor visitor_; 3545 Visitor visitor_;
3537 AstValueFactory* ast_value_factory_; 3546 AstValueFactory* ast_value_factory_;
3538 AstNode::IdGen* id_gen_; 3547 AstNode::IdGen* id_gen_;
3539 }; 3548 };
3540 3549
3541 3550
3542 } } // namespace v8::internal 3551 } } // namespace v8::internal
3543 3552
3544 #endif // V8_AST_H_ 3553 #endif // V8_AST_H_
OLDNEW
« 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