Index: src/ast/modules.h |
diff --git a/src/ast/modules.h b/src/ast/modules.h |
index 7e78ac2bad9927332d1ee64a5cc5dfa252d16c0d..5d6ffaf6fb5ef159538308957a24f10b6f3ccce2 100644 |
--- a/src/ast/modules.h |
+++ b/src/ast/modules.h |
@@ -5,6 +5,11 @@ |
#ifndef V8_AST_MODULES_H_ |
#define V8_AST_MODULES_H_ |
+#ifdef DEBUG |
+// TODO: Remove before landing. |
+#include "src/ast/ast-value-factory.h" |
+#endif // DEBUG |
+ |
#include "src/parsing/scanner.h" // Only for Scanner::Location. |
#include "src/pending-compilation-error-handler.h" |
#include "src/zone-containers.h" |
@@ -14,6 +19,7 @@ namespace internal { |
class AstRawString; |
+class ModuleInfoEntry; |
class ModuleDescriptor : public ZoneObject { |
@@ -80,6 +86,7 @@ class ModuleDescriptor : public ZoneObject { |
const AstRawString* import_name; |
const AstRawString* module_request; |
+ // TODO(neis): Remove local_name component? |
explicit Entry(Scanner::Location loc) |
: location(loc), |
export_name(nullptr), |
@@ -87,9 +94,27 @@ class ModuleDescriptor : public ZoneObject { |
import_name(nullptr), |
module_request(nullptr) {} |
- Handle<FixedArray> Serialize(Isolate* isolate) const; |
+#ifdef DEBUG |
+ // TODO: Remove before landing. |
+ void Print() const { |
+ PrintF("export name: "); |
+ if (export_name != nullptr) { |
+ PrintF("%.*s\n", export_name->length(), export_name->raw_data()); |
+ } |
+ PrintF("local name: "); |
+ if (local_name != nullptr) { |
+ PrintF("%.*s\n", local_name->length(), local_name->raw_data()); |
+ // local_name->string()->ShortPrint(); |
+ } |
+ } |
+#endif // DEBUG |
+ |
+ // (De-)serialization support. |
+ // Note that the location value is not preserved as it's only needed by the |
+ // parser. (A Deserialize'd entry has an invalid location.) |
+ Handle<ModuleInfoEntry> Serialize(Isolate* isolate) const; |
static Entry* Deserialize(Isolate* isolate, AstValueFactory* avfactory, |
- Handle<FixedArray> data); |
+ Handle<ModuleInfoEntry> entry); |
}; |
// Empty imports and namespace imports. |
@@ -112,6 +137,10 @@ class ModuleDescriptor : public ZoneObject { |
return regular_exports_; |
} |
+#ifdef DEBUG |
+ void Print() const; |
+#endif // DEBUG |
+ |
void AddRegularExport(Entry* entry) { |
DCHECK_NOT_NULL(entry->export_name); |
DCHECK_NOT_NULL(entry->local_name); |