more verbose unknown node error message in code generator

This commit is contained in:
Sebastian McKenzie
2015-01-01 22:34:51 +11:00
parent d7ca7ebbb9
commit 64b7d6fa93

View File

@@ -115,6 +115,7 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
if (!node) return "";
var self = this;
opts = opts || {};
var newline = function (leading) {
@@ -170,7 +171,7 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
this.printTrailingComments(node, parent);
} else {
throw new ReferenceError("unknown node " + node.type);
throw new ReferenceError("unknown node of type " + JSON.stringify(node.type) + " with constructor " + JSON.stringify(node && node.constructor.name));
}
};