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

Unified Diff: include/v8.h

Issue 2347933002: [modules] Introduce v8::Module to the API and return it from CompileModule (Closed)
Patch Set: Less maybe 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 816719e521de6de10587d23acd3cfd4635d7a067..c10881981abf7e1276d69184bdfa99f92121475e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1070,6 +1070,26 @@ class V8_EXPORT UnboundScript {
static const int kNoScriptId = 0;
};
+/**
+ * This is an unfinished experimental feature, and is only exposed
+ * here for internal testing purposes. DO NOT USE.
+ *
+ * A compiled JavaScript module.
+ */
+class V8_EXPORT Module {
+ public:
+ /**
+ * ModuleDeclarationInstantiation
+ *
+ * Returns false if an exception occurred during instantiation.
+ */
+ V8_WARN_UNUSED_RESULT bool Instantiate(Local<Context> context);
+
+ /**
+ * ModuleEvaluation
+ */
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
+};
/**
* A compiled JavaScript script, tied to a Context which was active when the
@@ -1373,18 +1393,17 @@ class V8_EXPORT ScriptCompiler {
static uint32_t CachedDataVersionTag();
/**
- * Compile an ES6 module.
- *
* This is an unfinished experimental feature, and is only exposed
- * here for internal testing purposes.
- * Only parsing works at the moment. Do not use.
+ * here for internal testing purposes. DO NOT USE.
*
- * TODO(adamk): Script is likely the wrong return value for this;
- * should return some new Module type.
+ * Compile an ES module, returning a Module that encapsulates
+ * the compiled code.
+ *
+ * Corresponds to the ParseModule abstract operation in the
+ * ECMAScript specification.
*/
- static V8_WARN_UNUSED_RESULT MaybeLocal<Script> CompileModule(
- Local<Context> context, Source* source,
- CompileOptions options = kNoCompileOptions);
+ static V8_WARN_UNUSED_RESULT MaybeLocal<Module> CompileModule(
+ Isolate* isolate, Source* source);
/**
* Compile a function for a given context. This is equivalent to running
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698