-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Keyan Zhang
committed
Aug 3, 2016
1 parent
ac72908
commit 1407224
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { interp, setLexical } = require('the-super-tiny-interpreter'); | ||
|
||
const code = ` | ||
const adder = (x) => (y) => x + y; | ||
const x = 100; | ||
const add3 = adder(3); | ||
log(add3(5)); | ||
`; | ||
|
||
setLexical(true); | ||
|
||
interp(code); // should log `8` | ||
|
||
setLexical(false); | ||
|
||
interp(code); // should log 105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,6 @@ | |
"testPathDirs": [ | ||
"<rootDir>/src" | ||
] | ||
} | ||
}, | ||
"tonicExampleFilename": "examples/tonic/tonicExample.js" | ||
} |