Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Commit

Permalink
Add functions to the sources in the repl. Fixes #192.
Browse files Browse the repository at this point in the history
  • Loading branch information
joneshf committed Aug 8, 2013
1 parent 301c1fa commit fc94e73
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/node-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,15 @@ var nodeRepl = function(opts) {
ast = parser.parse(tokens);
if (typeof ast.body[0] != 'undefined') {
ast.body[0].accept({
// Simple bindings.
// E.g.: let x = 37
visitLet: function(n) {
sources[n.name] = n.value;
},
// Bindings that are actually functions.
// E.g.: let f x = 37
visitFunction: function(n) {
sources[n.name] = n;
}
});
}
Expand Down

0 comments on commit fc94e73

Please sign in to comment.