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

Side by Side Diff: src/ast.h

Issue 624013005: Classes: Add support for toString (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add type checks 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 | src/full-codegen.cc » ('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 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after
2529 public: 2529 public:
2530 typedef ObjectLiteralProperty Property; 2530 typedef ObjectLiteralProperty Property;
2531 2531
2532 DECLARE_NODE_TYPE(ClassLiteral) 2532 DECLARE_NODE_TYPE(ClassLiteral)
2533 2533
2534 Handle<String> name() const { return raw_name_->string(); } 2534 Handle<String> name() const { return raw_name_->string(); }
2535 const AstRawString* raw_name() const { return raw_name_; } 2535 const AstRawString* raw_name() const { return raw_name_; }
2536 Expression* extends() const { return extends_; } 2536 Expression* extends() const { return extends_; }
2537 Expression* constructor() const { return constructor_; } 2537 Expression* constructor() const { return constructor_; }
2538 ZoneList<Property*>* properties() const { return properties_; } 2538 ZoneList<Property*>* properties() const { return properties_; }
2539 int start_position() const { return position(); }
2540 int end_position() const { return end_position_; }
2539 2541
2540 protected: 2542 protected:
2541 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends, 2543 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends,
2542 Expression* constructor, ZoneList<Property*>* properties, 2544 Expression* constructor, ZoneList<Property*>* properties,
2543 int position, IdGen* id_gen) 2545 int start_position, int end_position, IdGen* id_gen)
2544 : Expression(zone, position, id_gen), 2546 : Expression(zone, start_position, id_gen),
2545 raw_name_(name), 2547 raw_name_(name),
2546 extends_(extends), 2548 extends_(extends),
2547 constructor_(constructor), 2549 constructor_(constructor),
2548 properties_(properties) {} 2550 properties_(properties),
2551 end_position_(end_position) {}
2549 2552
2550 private: 2553 private:
2551 const AstRawString* raw_name_; 2554 const AstRawString* raw_name_;
2552 Expression* extends_; 2555 Expression* extends_;
2553 Expression* constructor_; 2556 Expression* constructor_;
2554 ZoneList<Property*>* properties_; 2557 ZoneList<Property*>* properties_;
2558 int end_position_;
2555 }; 2559 };
2556 2560
2557 2561
2558 class NativeFunctionLiteral FINAL : public Expression { 2562 class NativeFunctionLiteral FINAL : public Expression {
2559 public: 2563 public:
2560 DECLARE_NODE_TYPE(NativeFunctionLiteral) 2564 DECLARE_NODE_TYPE(NativeFunctionLiteral)
2561 2565
2562 Handle<String> name() const { return name_->string(); } 2566 Handle<String> name() const { return name_->string(); }
2563 v8::Extension* extension() const { return extension_; } 2567 v8::Extension* extension() const { return extension_; }
2564 2568
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
3528 // Top-level literal doesn't count for the AST's properties. 3532 // Top-level literal doesn't count for the AST's properties.
3529 if (is_function == FunctionLiteral::kIsFunction) { 3533 if (is_function == FunctionLiteral::kIsFunction) {
3530 visitor_.VisitFunctionLiteral(lit); 3534 visitor_.VisitFunctionLiteral(lit);
3531 } 3535 }
3532 return lit; 3536 return lit;
3533 } 3537 }
3534 3538
3535 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends, 3539 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends,
3536 Expression* constructor, 3540 Expression* constructor,
3537 ZoneList<ObjectLiteral::Property*>* properties, 3541 ZoneList<ObjectLiteral::Property*>* properties,
3538 int position) { 3542 int start_position, int end_position) {
3539 ClassLiteral* lit = new (zone_) ClassLiteral( 3543 ClassLiteral* lit =
3540 zone_, name, extends, constructor, properties, position, id_gen_); 3544 new (zone_) ClassLiteral(zone_, name, extends, constructor, properties,
3545 start_position, end_position, id_gen_);
3541 VISIT_AND_RETURN(ClassLiteral, lit) 3546 VISIT_AND_RETURN(ClassLiteral, lit)
3542 } 3547 }
3543 3548
3544 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, 3549 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
3545 v8::Extension* extension, 3550 v8::Extension* extension,
3546 int pos) { 3551 int pos) {
3547 NativeFunctionLiteral* lit = 3552 NativeFunctionLiteral* lit =
3548 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_); 3553 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_);
3549 VISIT_AND_RETURN(NativeFunctionLiteral, lit) 3554 VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3550 } 3555 }
(...skipping 15 matching lines...) Expand all
3566 Zone* zone_; 3571 Zone* zone_;
3567 Visitor visitor_; 3572 Visitor visitor_;
3568 AstValueFactory* ast_value_factory_; 3573 AstValueFactory* ast_value_factory_;
3569 AstNode::IdGen* id_gen_; 3574 AstNode::IdGen* id_gen_;
3570 }; 3575 };
3571 3576
3572 3577
3573 } } // namespace v8::internal 3578 } } // namespace v8::internal
3574 3579
3575 #endif // V8_AST_H_ 3580 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698