Skip to content

Commit

Permalink
Fix compilation error on node versions < 10
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Oct 22, 2019
1 parent 9ced230 commit 56372e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/node.cc
Expand Up @@ -473,12 +473,18 @@ bool symbol_set_from_js(SymbolSet *symbols, const Local<Value> &value, const TSL
if (Nan::Get(js_types, i).ToLocal(&js_node_type_value)) {
Local<String> js_node_type;
if (Nan::To<String>(js_node_type_value).ToLocal(&js_node_type)) {
std::string node_type(js_node_type->Utf8Length(Isolate::GetCurrent()), '\0');
auto length = js_node_type->Utf8Length(
#if NODE_MAJOR_VERSION >= 12
Isolate::GetCurrent()
#endif
);

std::string node_type(length, '\0');
js_node_type->WriteUtf8(

// Nan doesn't wrap this functionality
#if NODE_MAJOR_VERSION >= 12
Isolate::GetCurrent(),
Isolate::GetCurrent(),
#endif

&node_type[0]
Expand Down
2 changes: 1 addition & 1 deletion src/parser.cc
Expand Up @@ -73,7 +73,7 @@ class CallbackInput {

// Nan doesn't wrap this functionality
#if NODE_MAJOR_VERSION >= 12
Isolate::GetCurrent(),
Isolate::GetCurrent(),
#endif

reader->buffer.data(),
Expand Down

0 comments on commit 56372e6

Please sign in to comment.