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

Side by Side Diff: src/ast/modules.h

Issue 2328283002: Revert of [modules] Basic support of exports (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/modules.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_MODULES_H_ 5 #ifndef V8_AST_MODULES_H_
6 #define V8_AST_MODULES_H_ 6 #define V8_AST_MODULES_H_
7 7
8 #include "src/parsing/scanner.h" // Only for Scanner::Location. 8 #include "src/parsing/scanner.h" // Only for Scanner::Location.
9 #include "src/pending-compilation-error-handler.h" 9 #include "src/pending-compilation-error-handler.h"
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 15
16 class AstRawString; 16 class AstRawString;
17 class ModuleInfoEntry; 17
18 18
19 class ModuleDescriptor : public ZoneObject { 19 class ModuleDescriptor : public ZoneObject {
20 public: 20 public:
21 explicit ModuleDescriptor(Zone* zone) 21 explicit ModuleDescriptor(Zone* zone)
22 : special_exports_(1, zone), 22 : special_exports_(1, zone),
23 special_imports_(1, zone), 23 special_imports_(1, zone),
24 regular_exports_(zone), 24 regular_exports_(zone),
25 regular_imports_(zone) {} 25 regular_imports_(zone) {}
26 26
27 // The following Add* methods are high-level convenience functions for use by 27 // The following Add* methods are high-level convenience functions for use by
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool Validate(ModuleScope* module_scope, 73 bool Validate(ModuleScope* module_scope,
74 PendingCompilationErrorHandler* error_handler, Zone* zone); 74 PendingCompilationErrorHandler* error_handler, Zone* zone);
75 75
76 struct Entry : public ZoneObject { 76 struct Entry : public ZoneObject {
77 const Scanner::Location location; 77 const Scanner::Location location;
78 const AstRawString* export_name; 78 const AstRawString* export_name;
79 const AstRawString* local_name; 79 const AstRawString* local_name;
80 const AstRawString* import_name; 80 const AstRawString* import_name;
81 const AstRawString* module_request; 81 const AstRawString* module_request;
82 82
83 // TODO(neis): Remove local_name component?
84 explicit Entry(Scanner::Location loc) 83 explicit Entry(Scanner::Location loc)
85 : location(loc), 84 : location(loc),
86 export_name(nullptr), 85 export_name(nullptr),
87 local_name(nullptr), 86 local_name(nullptr),
88 import_name(nullptr), 87 import_name(nullptr),
89 module_request(nullptr) {} 88 module_request(nullptr) {}
90 89
91 // (De-)serialization support. 90 Handle<FixedArray> Serialize(Isolate* isolate) const;
92 // Note that the location value is not preserved as it's only needed by the
93 // parser. (A Deserialize'd entry has an invalid location.)
94 Handle<ModuleInfoEntry> Serialize(Isolate* isolate) const;
95 static Entry* Deserialize(Isolate* isolate, AstValueFactory* avfactory, 91 static Entry* Deserialize(Isolate* isolate, AstValueFactory* avfactory,
96 Handle<ModuleInfoEntry> entry); 92 Handle<FixedArray> data);
97 }; 93 };
98 94
99 // Empty imports and namespace imports. 95 // Empty imports and namespace imports.
100 const ZoneList<const Entry*>& special_imports() const { 96 const ZoneList<const Entry*>& special_imports() const {
101 return special_imports_; 97 return special_imports_;
102 } 98 }
103 99
104 // All the remaining imports, indexed by local name. 100 // All the remaining imports, indexed by local name.
105 const ZoneMap<const AstRawString*, const Entry*>& regular_imports() const { 101 const ZoneMap<const AstRawString*, const Entry*>& regular_imports() const {
106 return regular_imports_; 102 return regular_imports_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // into: 167 // into:
172 // import {a as b} from "X"; export {a as c} from "X"; 168 // import {a as b} from "X"; export {a as c} from "X";
173 // (The import entry is never deleted.) 169 // (The import entry is never deleted.)
174 void MakeIndirectExportsExplicit(Zone* zone); 170 void MakeIndirectExportsExplicit(Zone* zone);
175 }; 171 };
176 172
177 } // namespace internal 173 } // namespace internal
178 } // namespace v8 174 } // namespace v8
179 175
180 #endif // V8_AST_MODULES_H_ 176 #endif // V8_AST_MODULES_H_
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/modules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698