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

Side by Side Diff: src/ast.h

Issue 9401008: Parsing of basic module declarations (no imports/exports yet). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Lasse's comments. Created 8 years, 10 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/contexts.h » ('j') | src/parser.cc » ('J')
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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 private: 542 private:
543 Block* body_; 543 Block* body_;
544 }; 544 };
545 545
546 546
547 class ModuleVariable: public Module { 547 class ModuleVariable: public Module {
548 public: 548 public:
549 DECLARE_NODE_TYPE(ModuleVariable) 549 DECLARE_NODE_TYPE(ModuleVariable)
550 550
551 Variable* var() const { return var_; } 551 VariableProxy* proxy() const { return proxy_; }
552 552
553 protected: 553 protected:
554 template<class> friend class AstNodeFactory; 554 template<class> friend class AstNodeFactory;
555 555
556 explicit ModuleVariable(Variable* var) 556 explicit ModuleVariable(VariableProxy* proxy)
557 : var_(var) { 557 : proxy_(proxy) {
558 } 558 }
559 559
560 private: 560 private:
561 Variable* var_; 561 VariableProxy* proxy_;
562 }; 562 };
563 563
564 564
565 class ModulePath: public Module { 565 class ModulePath: public Module {
566 public: 566 public:
567 DECLARE_NODE_TYPE(ModulePath) 567 DECLARE_NODE_TYPE(ModulePath)
568 568
569 Module* module() const { return module_; } 569 Module* module() const { return module_; }
570 Handle<String> name() const { return name_; } 570 Handle<String> name() const { return name_; }
571 571
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
2529 ModuleDeclaration* decl = 2529 ModuleDeclaration* decl =
2530 new(zone_) ModuleDeclaration(proxy, module, scope); 2530 new(zone_) ModuleDeclaration(proxy, module, scope);
2531 VISIT_AND_RETURN(ModuleDeclaration, decl) 2531 VISIT_AND_RETURN(ModuleDeclaration, decl)
2532 } 2532 }
2533 2533
2534 ModuleLiteral* NewModuleLiteral(Block* body) { 2534 ModuleLiteral* NewModuleLiteral(Block* body) {
2535 ModuleLiteral* module = new(zone_) ModuleLiteral(body); 2535 ModuleLiteral* module = new(zone_) ModuleLiteral(body);
2536 VISIT_AND_RETURN(ModuleLiteral, module) 2536 VISIT_AND_RETURN(ModuleLiteral, module)
2537 } 2537 }
2538 2538
2539 ModuleVariable* NewModuleVariable(Variable* var) { 2539 ModuleVariable* NewModuleVariable(VariableProxy* proxy) {
2540 ModuleVariable* module = new(zone_) ModuleVariable(var); 2540 ModuleVariable* module = new(zone_) ModuleVariable(proxy);
2541 VISIT_AND_RETURN(ModuleLiteral, module) 2541 VISIT_AND_RETURN(ModuleVariable, module)
2542 } 2542 }
2543 2543
2544 ModulePath* NewModulePath(Module* origin, Handle<String> name) { 2544 ModulePath* NewModulePath(Module* origin, Handle<String> name) {
2545 ModulePath* module = new(zone_) ModulePath(origin, name); 2545 ModulePath* module = new(zone_) ModulePath(origin, name);
2546 VISIT_AND_RETURN(ModuleLiteral, module) 2546 VISIT_AND_RETURN(ModulePath, module)
2547 } 2547 }
2548 2548
2549 ModuleUrl* NewModuleUrl(Handle<String> url) { 2549 ModuleUrl* NewModuleUrl(Handle<String> url) {
2550 ModuleUrl* module = new(zone_) ModuleUrl(url); 2550 ModuleUrl* module = new(zone_) ModuleUrl(url);
2551 VISIT_AND_RETURN(ModuleLiteral, module) 2551 VISIT_AND_RETURN(ModuleUrl, module)
2552 } 2552 }
2553 2553
2554 Block* NewBlock(ZoneStringList* labels, 2554 Block* NewBlock(ZoneStringList* labels,
2555 int capacity, 2555 int capacity,
2556 bool is_initializer_block) { 2556 bool is_initializer_block) {
2557 Block* block = new(zone_) Block( 2557 Block* block = new(zone_) Block(
2558 isolate_, labels, capacity, is_initializer_block); 2558 isolate_, labels, capacity, is_initializer_block);
2559 VISIT_AND_RETURN(Block, block) 2559 VISIT_AND_RETURN(Block, block)
2560 } 2560 }
2561 2561
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 private: 2824 private:
2825 Isolate* isolate_; 2825 Isolate* isolate_;
2826 Zone* zone_; 2826 Zone* zone_;
2827 Visitor visitor_; 2827 Visitor visitor_;
2828 }; 2828 };
2829 2829
2830 2830
2831 } } // namespace v8::internal 2831 } } // namespace v8::internal
2832 2832
2833 #endif // V8_AST_H_ 2833 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/contexts.h » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698