Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
chakrashim: shim new v8::Module APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhorton authored and kfarnung committed Jan 9, 2018
1 parent 00e0d1b commit ccf99e0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
23 changes: 23 additions & 0 deletions deps/chakrashim/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,23 @@ class V8_EXPORT Locker {

class V8_EXPORT Module {
public:
/**
* The different states a module can be in.
*/
enum Status {
kUninstantiated,
kInstantiating,
kInstantiated,
kEvaluating,
kEvaluated,
kErrored
};

/**
* Returns the module's current status.
*/
Status GetStatus() const;

/**
* Returns the number of modules requested by this module.
*/
Expand Down Expand Up @@ -2903,6 +2920,12 @@ class V8_EXPORT Module {
* Returns the completion value.
*/
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);

/**
* Returns the namespace object of this module.
* The module's status must be kEvaluated.
*/
Local<Value> GetModuleNamespace();
};


Expand Down
20 changes: 10 additions & 10 deletions deps/chakrashim/src/v8module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,27 @@

#include "v8chakra.h"

// CHAKRA-TODO: Find a way to support es6 modules under
// the constraints of the node implementation

namespace v8 {
Module::Status Module::GetStatus() const {
return kUninstantiated;
}

int Module::GetModuleRequestsLength() const {
// CHAKRA-TODO: Find a way to support es6 modules under
// the constraints of the node implementation
return 0;
}

Local<String> Module::GetModuleRequest(int i) const {
// CHAKRA-TODO: Find a way to support es6 modules under
// the constraints of the node implementation
return Local<String>();
}

int Module::GetIdentityHash() const {
// CHAKRA-TODO: Find a way to support es6 modules under
// the constraints of the node implementation
return 0;
}

bool Module::Instantiate(Local<Context> context, ResolveCallback callback) {
// CHAKRA-TODO: Find a way to support es6 modules under
// the constraints of the node implementation
return false;
}

Expand All @@ -52,9 +50,11 @@ namespace v8 {
}

MaybeLocal<Value> Module::Evaluate(Local<Context> context) {
// CHAKRA-TODO: Find a way to support es6 modules under
// the constraints of the node implementation
return Local<Value>();
}

Local<Value> Module::GetModuleNamespace() {
return Local<Value>();
}

} // namespace v8

0 comments on commit ccf99e0

Please sign in to comment.