Skip to content

Commit 7fce9d3

Browse files
committed
fix: adding suggested changes
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 72651d0 commit 7fce9d3

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

lib/node_modules/@stdlib/repl/lib/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function defaults() {
108108
// Theme for syntax highlighting:
109109
'theme': 'stdlib-ansi-basic',
110110

111-
// Flag indicating whether to enable eager Evaluation (note: default depends on whether TTY):
111+
// Flag indicating whether to enable eager evaluation (note: default depends on whether TTY):
112112
'eagerEvaluation': void 0
113113
}
114114
};

lib/node_modules/@stdlib/repl/lib/eager_evaluation.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var compileCommand = require( './compile_command.js' );
3535

3636
// VARIABLES //
3737

38-
var debug = logger( 'repl:EE' );
38+
var debug = logger( 'repl:eager_evaluation' );
3939
var AOPTS = {
4040
'ecmaVersion': 'latest'
4141
};
@@ -49,7 +49,7 @@ var tempDB = {
4949
// MAIN //
5050

5151
/**
52-
* Constructor for creating a multi-line handler.
52+
* Constructor for creating a eager evaluator.
5353
*
5454
* @private
5555
* @param {REPL} repl - repl instance
@@ -58,10 +58,19 @@ var tempDB = {
5858
* @returns {EagerEvaluator} eager-evaluator instance
5959
*/
6060
function EagerEvaluator( repl, rli, enabled ) {
61+
// Cache a reference to the provided REPL instance:
6162
this._repl = repl;
63+
64+
// Cache a reference to the readline interface:
6265
this._rli = rli;
66+
67+
// Cache a reference to the command array:
6368
this._cmd = repl._cmd;
69+
70+
// Flag indicate weather eagerevaluation is enable or not
6471
this._enabled = enabled;
72+
73+
// Flag indicate weather preview is on terminal or not
6574
this._isPreview = false;
6675

6776
return this;
@@ -78,7 +87,7 @@ function EagerEvaluator( repl, rli, enabled ) {
7887
* @returns {void}
7988
*
8089
*/
81-
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeyPress() {
90+
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeypress() {
8291
var cursorPosition;
8392
var executable;
8493
var nlInd;
@@ -136,9 +145,6 @@ setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeyP
136145
readline.moveCursor(this._repl._ostream, 0, -1);
137146
readline.cursorTo(this._repl._ostream, cursorPosition + this._repl.promptLength() );
138147
this._isPreview = true;
139-
executable.raw = code;
140-
this._repl._isEagerEvaluated = true;
141-
this._repl._eagerEvaluatedExecutable = executable;
142148
debug( 'sucess' );
143149
});
144150

@@ -153,19 +159,17 @@ setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeyP
153159
* @returns {void}
154160
*
155161
*/
156-
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'beforeKeypress', function beforeKeyPress() {
162+
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'beforeKeypress', function beforeKeypress() {
157163
if (!this._isPreview ) {
158164
return;
159165
}
160166
if ( this._isPreview ) {
161167
this.clear();
162168
}
163-
this._repl._isEagerEvaluated = false;
164-
this._repl._eagerEvaluatedExecutable = void 0;
165169
});
166170

167171
/**
168-
* Tells weather code is side effect free or not.
172+
* Function to determine if code is side-effect-free.
169173
*
170174
* @name isSideEffectFree
171175
* @memberof EagerEvaluator.prototype
@@ -197,8 +201,8 @@ setNonEnumerableReadOnly( EagerEvaluator.prototype, 'isSideEffectFree', function
197201
* Function which recursivly traverse from the node and tells weather node is side effect free or not.
198202
*
199203
* @private
200-
* @param {JSON} node - ast node.
201-
* @returns {Boolean} - Boolean indicate weather node is side effect free or not.
204+
* @param {Object} node - ast node
205+
* @returns {Boolean} - boolean indicating whether the node is side effect free or not
202206
*/
203207
function traverse(node) {
204208
var fname;
@@ -238,7 +242,7 @@ setNonEnumerableReadOnly( EagerEvaluator.prototype, 'isSideEffectFree', function
238242
* Get the underscore seprate function name for the member function call.
239243
*
240244
* @private
241-
* @param {JSON} node - ast node
245+
* @param {Object} node - ast node
242246
* @returns {string} - underscore seprated function name for the member function call
243247
*/
244248
function getFunctionName( node ) {

lib/node_modules/@stdlib/repl/lib/main.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ function REPL( options ) {
263263
// Initialize an internal flag indicating whether we've received a `SIGINT` signal:
264264
setNonEnumerable( this, '_SIGINT', false );
265265

266-
// Initialize an internal flag indicating whether command is eagerlyEvaluated:
267-
setNonEnumerable( this, '_isEagerEvaluated', false );
268-
269-
// Initialize as internal variable for caching the compiled object from eagerEvaluation
270-
setNonEnumerable( this, '_eagerEvaluatedExecutable', void 0 );
271-
272266
// Initialize an internal variable for caching the result of the last successfully evaluated command:
273267
setNonEnumerable( this, '_ans', void 0 );
274268

@@ -380,7 +374,6 @@ function REPL( options ) {
380374
self._autoCloser.beforeKeypress( data, key );
381375
completed = self._previewCompleter.beforeKeypress( data, key );
382376
FLG = self._editorActions.beforeKeypress( data, key );
383-
384377
self._eagerEvaluator.beforeKeypress( data, key );
385378

386379
// If ENTER keypress is encountered or if a preview was completed while navigating, gracefully close the completer...

0 commit comments

Comments
 (0)