add --ast-help

displays a rather cruel description of the AST classes, derived
directly from the node definitions.
This commit is contained in:
Mihai Bazon
2012-10-09 13:21:21 +03:00
parent 2c025f23db
commit e1862cd36f
3 changed files with 59 additions and 8 deletions

View File

@@ -43,8 +43,6 @@
"use strict";
var NODE_HIERARCHY = {};
function DEFNODE(type, props, methods, base) {
if (arguments.length < 4) base = AST_Node;
if (!props) props = [];
@@ -67,9 +65,11 @@ function DEFNODE(type, props, methods, base) {
ctor.prototype = proto;
ctor.BASE = base;
}
if (base) base.SUBCLASSES.push(ctor);
ctor.prototype.CTOR = ctor;
ctor.PROPS = props || null;
ctor.SELF_PROPS = self_props;
ctor.SUBCLASSES = [];
if (type) {
ctor.prototype.TYPE = ctor.TYPE = type;
}
@@ -83,10 +83,6 @@ function DEFNODE(type, props, methods, base) {
ctor.DEFMETHOD = function(name, method) {
this.prototype[name] = method;
};
NODE_HIERARCHY[type] = {
def: ctor,
base: base
};
return ctor;
};