-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate prefix nums in eval contexts [fix]
Fixes #538.
- Loading branch information
1 parent
e95ff7c
commit 6838ae3
Showing
3 changed files
with
79 additions
and
34 deletions.
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
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
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,29 @@ | ||
/* -------------------- | ||
* livepack module | ||
* Init. | ||
* Create tracker function for file or for `eval()`. | ||
* ------------------*/ | ||
|
||
'use strict'; | ||
|
||
// Export before imports to avoid circular require with `./eval.js` | ||
module.exports = createTracker; | ||
|
||
// Imports | ||
const addEvalFunctionsToTracker = require('./eval.js'), | ||
{tracker} = require('../shared/tracker.js'); | ||
|
||
// Exports | ||
|
||
/** | ||
* Create local tracker function with additional properties and methods specific to the file. | ||
* @param {string} filename - File path | ||
* @param {Object} blockIdCounter - Block ID counter for file | ||
* @param {number} prefixNum - Internal vars prefix num | ||
* @returns {Function} - Local tracker function | ||
*/ | ||
function createTracker(filename, blockIdCounter, prefixNum) { | ||
const localTracker = (getFnInfo, getScopes) => tracker(getFnInfo, getScopes); | ||
addEvalFunctionsToTracker(localTracker, filename, blockIdCounter, prefixNum); | ||
return localTracker; | ||
} |