diff options
Diffstat (limited to 'src/node_process_events.cc')
-rw-r--r-- | src/node_process_events.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/node_process_events.cc b/src/node_process_events.cc index 06096226625..d192ef19b7a 100644 --- a/src/node_process_events.cc +++ b/src/node_process_events.cc @@ -1,4 +1,5 @@ #include <cstdarg> +#include <set> #include "env-inl.h" #include "node_process.h" @@ -95,6 +96,21 @@ Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...) { return ProcessEmitWarningGeneric(env, warning); } + +std::set<std::string> experimental_warnings; + +Maybe<bool> ProcessEmitExperimentalWarning(Environment* env, + const char* warning) { + if (experimental_warnings.find(warning) != experimental_warnings.end()) + return Nothing<bool>(); + + experimental_warnings.insert(warning); + std::string message(warning); + message.append( + " is an experimental feature. This feature could change at any time"); + return ProcessEmitWarningGeneric(env, message.c_str(), "ExperimentalWarning"); +} + Maybe<bool> ProcessEmitDeprecationWarning(Environment* env, const char* warning, const char* deprecation_code) { |