From 56372e628f29f28b1e9f369055202f4f8b2af695 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 22 Oct 2019 15:59:43 -0700 Subject: [PATCH] Fix compilation error on node versions < 10 --- src/node.cc | 10 ++++++++-- src/parser.cc | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/node.cc b/src/node.cc index 12d139c7..14054544 100644 --- a/src/node.cc +++ b/src/node.cc @@ -473,12 +473,18 @@ bool symbol_set_from_js(SymbolSet *symbols, const Local &value, const TSL if (Nan::Get(js_types, i).ToLocal(&js_node_type_value)) { Local js_node_type; if (Nan::To(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] diff --git a/src/parser.cc b/src/parser.cc index 39202006..52e1beac 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -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(),