private String debugInfo(Node node) {
StringBuilder sb = new StringBuilder();
if (node instanceof FunctionNode) {
FunctionNode fn = (FunctionNode)node;
sb.append("FunctionNode name: ").append(fn.getName());
sb.append(", Ident: ").append(fn.getIdent());
if (fn.allVarsInScope()) sb.append(", allVarsInScope");
if (fn.isAnonymous()) sb.append(", isAnonymous");
if (fn.isDeclared()) sb.append(", isDeclared");
if (fn.isMethod()) sb.append(", isMethod");
if (fn.isNamedFunctionExpression()) sb.append(", isNamedFunctionExpression");
if (fn.isVarArg()) sb.append(", isVarArg");
if (fn.hasDeclaredFunctions()) sb.append(", hasDeclaredFunctions");
if (fn.hasDirectSuper()) sb.append(", hasDirectSuper");
} else if (node instanceof VarNode) {
VarNode vn = (VarNode)node;
sb.append("VarNode ").append(vn.getName());
if (vn.isBlockScoped()) sb.append(", isBlockScoped");
if (vn.isConst()) sb.append(", isConst");
if (vn.isFunctionDeclaration()) sb.append(", isFunctionDeclaration");
if (vn.isLet()) sb.append(", isLet");
} else {
sb.append(node.getClass().getName());
}
return sb.toString();
}