diff options
author | Jason Ginchereau <jasongin@microsoft.com> | 2017-04-20 13:01:07 -0700 |
---|---|---|
committer | Michael Dawson <michael_dawson@ca.ibm.com> | 2017-04-27 16:33:19 -0400 |
commit | 427125491f3516fc80030f16e1536c3fa30ac929 (patch) | |
tree | 9c988e44b6e09e908f49b98abaec57d21c3732f2 /src | |
parent | 892ce06dbd8437b6f6308907231dc13ffebfe4f0 (diff) | |
download | android-node-v8-427125491f3516fc80030f16e1536c3fa30ac929.tar.gz android-node-v8-427125491f3516fc80030f16e1536c3fa30ac929.tar.bz2 android-node-v8-427125491f3516fc80030f16e1536c3fa30ac929.zip |
n-api: Reference and external tests
- Add a test project to addons-napi that covers the
N-API reference and external APIs
- Fix a bug in napi_typeof that was found by the new tests
PR-URL: https://github.com/nodejs/node/pull/12551
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_api.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node_api.cc b/src/node_api.cc index e1a5f1fdcb..649f18e376 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1464,6 +1464,10 @@ napi_status napi_typeof(napi_env env, // This test has to come before IsObject because IsFunction // implies IsObject *result = napi_function; + } else if (v->IsExternal()) { + // This test has to come before IsObject because IsExternal + // implies IsObject + *result = napi_external; } else if (v->IsObject()) { *result = napi_object; } else if (v->IsBoolean()) { @@ -1474,8 +1478,6 @@ napi_status napi_typeof(napi_env env, *result = napi_symbol; } else if (v->IsNull()) { *result = napi_null; - } else if (v->IsExternal()) { - *result = napi_external; } else { // Should not get here unless V8 has added some new kind of value. return napi_set_last_error(env, napi_invalid_arg); |