Permalink
Browse files

Register experimental features only with ENABLE_EXPERIMENTAL defined (f…

…ixes #687).
  • Loading branch information...
t-paul committed Mar 4, 2014
1 parent c1ed114 commit 0c2f2b074923c097b15e25f91756c3aa39cbe1bb
Showing with 14 additions and 2 deletions.
  1. +10 −0 src/builtin.cc
  2. +2 −1 src/function.h
  3. +2 −1 src/module.h
View
@@ -16,11 +16,21 @@ Builtins *Builtins::instance(bool erase)
void Builtins::init(const char *name, class AbstractModule *module)
{
+#ifndef ENABLE_EXPERIMENTAL
+ if (module->is_experimental()) {
+ return;
+ }
+#endif
Builtins::instance()->globalscope.modules[name] = module;
}
void Builtins::init(const char *name, class AbstractFunction *function)
{
+#ifndef ENABLE_EXPERIMENTAL
+ if (function->is_experimental()) {
+ return;
+ }
+#endif
Builtins::instance()->globalscope.functions[name] = function;
}
View
@@ -17,7 +17,8 @@ class AbstractFunction
AbstractFunction() : feature(NULL) {}
AbstractFunction(const Feature& feature) : feature(&feature) {}
virtual ~AbstractFunction();
- virtual bool is_enabled() const { return (feature == NULL) || feature->is_enabled(); };
+ virtual bool is_experimental() const { return feature != NULL; }
+ virtual bool is_enabled() const { return (feature == NULL) || feature->is_enabled(); }
virtual Value evaluate(const class Context *ctx, const class EvalContext *evalctx) const;
virtual std::string dump(const std::string &indent, const std::string &name) const;
};
View
@@ -67,7 +67,8 @@ class AbstractModule
AbstractModule() : feature(NULL) {}
AbstractModule(const Feature& feature) : feature(&feature) {}
virtual ~AbstractModule();
- virtual bool is_enabled() const { return (feature == NULL) || feature->is_enabled(); };
+ virtual bool is_experimental() const { return feature != NULL; }
+ virtual bool is_enabled() const { return (feature == NULL) || feature->is_enabled(); }
virtual class AbstractNode *instantiate(const Context *ctx, const ModuleInstantiation *inst, const class EvalContext *evalctx = NULL) const;
virtual std::string dump(const std::string &indent, const std::string &name) const;
};

0 comments on commit 0c2f2b0

Please sign in to comment.