Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Register experimental features only with ENABLE_EXPERIMENTAL defined …

…(fixes #687).
  • Loading branch information...
commit 0c2f2b074923c097b15e25f91756c3aa39cbe1bb 1 parent c1ed114
@t-paul t-paul authored
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
10 src/builtin.cc
@@ -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
3  src/function.h
@@ -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
3  src/module.h
@@ -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;
};
Please sign in to comment.
Something went wrong with that request. Please try again.