util: move flagged deprecation to internal/util
Two changes in this commit:
-
Deprecation-related logic is moved from buffer.js to internal/util.js That is the new deprecator() method that generates either a deprecation function or a noop, depending on the deprecation type and runtime flags.
-
Buffer pending deprecation stack trace is fixed, so that internal logic does not appear in there, and the first line of the stack should now point at userland code where the deprecated method was called.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
buffer, util
Perhaps I should benchmark this change, I am not exaclty sure if passing Buffer
as an argument in that place is a great idea. This way it's more flexible, but making it an argument of deprecator
could be faster (or not) — I probably need to check that.