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

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

Issue 2353403003: [modules] Support exporting a local variable under multiple export names. (Closed)
Patch Set: Comments Created 4 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
« no previous file with comments | « src/api.cc ('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/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // We don't care if there's already an entry for this local name, as in that 148 // We don't care if there's already an entry for this local name, as in that
149 // case we will report an error when declaring the variable. 149 // case we will report an error when declaring the variable.
150 } 150 }
151 151
152 void AddSpecialImport(const Entry* entry, Zone* zone) { 152 void AddSpecialImport(const Entry* entry, Zone* zone) {
153 DCHECK_NULL(entry->export_name); 153 DCHECK_NULL(entry->export_name);
154 DCHECK_LE(0, entry->module_request); 154 DCHECK_LE(0, entry->module_request);
155 special_imports_.Add(entry, zone); 155 special_imports_.Add(entry, zone);
156 } 156 }
157 157
158 Handle<FixedArray> SerializeRegularExports(Isolate* isolate,
159 Zone* zone) const;
160 void DeserializeRegularExports(Isolate* isolate, AstValueFactory* avfactory,
161 Handle<FixedArray> data);
162
158 private: 163 private:
159 // TODO(neis): Use STL datastructure instead of ZoneList? 164 // TODO(neis): Use STL datastructure instead of ZoneList?
160 ZoneMap<const AstRawString*, int> module_requests_; 165 ZoneMap<const AstRawString*, int> module_requests_;
161 ZoneList<const Entry*> special_exports_; 166 ZoneList<const Entry*> special_exports_;
162 ZoneList<const Entry*> special_imports_; 167 ZoneList<const Entry*> special_imports_;
163 ZoneMultimap<const AstRawString*, Entry*> regular_exports_; 168 ZoneMultimap<const AstRawString*, Entry*> regular_exports_;
164 ZoneMap<const AstRawString*, const Entry*> regular_imports_; 169 ZoneMap<const AstRawString*, const Entry*> regular_imports_;
165 170
166 // If there are multiple export entries with the same export name, return the 171 // If there are multiple export entries with the same export name, return the
167 // last of them (in source order). Otherwise return nullptr. 172 // last of them (in source order). Otherwise return nullptr.
(...skipping 23 matching lines...) Expand all
191 .insert(std::make_pair(specifier, module_requests_.size())) 196 .insert(std::make_pair(specifier, module_requests_.size()))
192 .first; 197 .first;
193 return it->second; 198 return it->second;
194 } 199 }
195 }; 200 };
196 201
197 } // namespace internal 202 } // namespace internal
198 } // namespace v8 203 } // namespace v8
199 204
200 #endif // V8_AST_MODULES_H_ 205 #endif // V8_AST_MODULES_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/ast/modules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698