Avoid using exports when they are not defined (like running in a browser).

This commit is contained in:
Ondřej Španěl 2017-02-08 09:22:39 +01:00
parent 7f8d72d9d3
commit 4bddd5c5a2

View File

@ -81,7 +81,9 @@ function DEFNODE(type, props, methods, base) {
ctor.DEFMETHOD = function(name, method) {
this.prototype[name] = method;
};
exports["AST_" + type] = ctor;
if (typeof exports !== "undefined") {
exports["AST_" + type] = ctor;
}
return ctor;
};