From 7cd37b7f0ef2519a39ecdd5334888ce006dcf80d Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Fri, 23 Jun 2017 23:27:08 +0300 Subject: [PATCH] N-API: Remove reference to node internals We must keep src/node_api.cc free of node internals because it must build cleanly outside of node as well - for example in node_addon_api. --- src/node_api.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node_api.cc b/src/node_api.cc index 18ff7b64e4e5a3..9245db989060e2 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -17,7 +17,9 @@ #include #include "uv.h" #include "node_api.h" -#include "node_internals.h" + +// We must avoid making use of node internals because this file must compile +// outside of node as well. #define NAPI_VERSION 1 @@ -759,7 +761,8 @@ napi_status napi_get_last_error_info(napi_env env, // We don't have a napi_status_last as this would result in an ABI // change each time a message was added. static_assert( - node::arraysize(error_messages) == napi_escape_called_twice + 1, + (sizeof (error_messages) / sizeof (*error_messages)) == + napi_escape_called_twice + 1, "Count of error messages must match count of error values"); assert(env->last_error.error_code <= napi_escape_called_twice);