nan icon indicating copy to clipboard operation
nan copied to clipboard

tools/1to2.js fails to generate proper source

Open Gottox opened this issue 10 years ago • 1 comments

I'm using NAN-1 with https://github.com/Gottox/child_pty. In https://github.com/Gottox/child_pty/issues/7 it came up, that NAN-2 breaks the build process.

I tried to use the 1to2.js script, but it generates wrong constructs, such as:

-               if(obj->Has(columns))
-                       w->ws_col = obj->Get(columns)->Uint32Value();
-               if(obj->Has(rows))
-                       w->ws_row = obj->Get(rows)->Uint32Value();
+               NanHas(if(obj, columns))
+                       w->ws_col = NanGet(obj, columns)->Uint32Value();
+               NanHas(if(obj, rows))
+                       w->ws_row = NanGet(obj, rows)->Uint32Value();

Furthermore, I'd really like to have a comprehensive migration guide. (https://github.com/nodejs/nan/issues/402)

Gottox avatar Sep 06 '15 19:09 Gottox

Yeah, it has not been updated. The main thing that needs changing is the replacement of Nan prefix with Nan namespace, but I don't really feel like doing it. I'll merge a PR if someone wants to update it.

You can try this bash script instead https://gist.github.com/thlorenz/7e9d8ad15566c99fd116

kkoopa avatar Sep 09 '15 11:09 kkoopa