|
|
|
@ -1,13 +1,6 @@
|
|
|
|
|
/* Simple AST node visitor builder. */
|
|
|
|
|
var visitor = {
|
|
|
|
|
/*
|
|
|
|
|
* Builds a node visitor -- a function which takes a node and any number of
|
|
|
|
|
* other parameters, calls an appropriate function according to the node type,
|
|
|
|
|
* passes it all its parameters and returns its value. The functions for
|
|
|
|
|
* various node types are passed in a parameter to |buildNodeVisitor| as a
|
|
|
|
|
* hash.
|
|
|
|
|
*/
|
|
|
|
|
buildNodeVisitor: function(functions) {
|
|
|
|
|
build: function(functions) {
|
|
|
|
|
return function(node) {
|
|
|
|
|
return functions[node.type].apply(null, arguments);
|
|
|
|
|
};
|
|
|
|
|