Skip to content

Commit

Permalink
fix: adding suggested changes
Browse files Browse the repository at this point in the history
---
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
---
  • Loading branch information
Vinit-Pandit committed Jan 25, 2025
1 parent 72651d0 commit 7fce9d3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/repl/lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function defaults() {
// Theme for syntax highlighting:
'theme': 'stdlib-ansi-basic',

// Flag indicating whether to enable eager Evaluation (note: default depends on whether TTY):
// Flag indicating whether to enable eager evaluation (note: default depends on whether TTY):
'eagerEvaluation': void 0
}
};
Expand Down
30 changes: 17 additions & 13 deletions lib/node_modules/@stdlib/repl/lib/eager_evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var compileCommand = require( './compile_command.js' );

// VARIABLES //

var debug = logger( 'repl:EE' );
var debug = logger( 'repl:eager_evaluation' );
var AOPTS = {
'ecmaVersion': 'latest'
};
Expand All @@ -49,7 +49,7 @@ var tempDB = {
// MAIN //

/**
* Constructor for creating a multi-line handler.
* Constructor for creating a eager evaluator.
*
* @private
* @param {REPL} repl - repl instance
Expand All @@ -58,10 +58,19 @@ var tempDB = {
* @returns {EagerEvaluator} eager-evaluator instance
*/
function EagerEvaluator( repl, rli, enabled ) {
// Cache a reference to the provided REPL instance:
this._repl = repl;

// Cache a reference to the readline interface:
this._rli = rli;

// Cache a reference to the command array:
this._cmd = repl._cmd;

// Flag indicate weather eagerevaluation is enable or not
this._enabled = enabled;

// Flag indicate weather preview is on terminal or not
this._isPreview = false;

return this;
Expand All @@ -78,7 +87,7 @@ function EagerEvaluator( repl, rli, enabled ) {
* @returns {void}
*
*/
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeyPress() {
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeypress() {
var cursorPosition;
var executable;
var nlInd;
Expand Down Expand Up @@ -136,9 +145,6 @@ setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeyP
readline.moveCursor(this._repl._ostream, 0, -1);
readline.cursorTo(this._repl._ostream, cursorPosition + this._repl.promptLength() );
this._isPreview = true;
executable.raw = code;
this._repl._isEagerEvaluated = true;
this._repl._eagerEvaluatedExecutable = executable;
debug( 'sucess' );
});

Expand All @@ -153,19 +159,17 @@ setNonEnumerableReadOnly(EagerEvaluator.prototype, 'onKeypress', function onKeyP
* @returns {void}
*
*/
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'beforeKeypress', function beforeKeyPress() {
setNonEnumerableReadOnly(EagerEvaluator.prototype, 'beforeKeypress', function beforeKeypress() {
if (!this._isPreview ) {
return;
}
if ( this._isPreview ) {
this.clear();
}
this._repl._isEagerEvaluated = false;
this._repl._eagerEvaluatedExecutable = void 0;
});

/**
* Tells weather code is side effect free or not.
* Function to determine if code is side-effect-free.
*
* @name isSideEffectFree
* @memberof EagerEvaluator.prototype
Expand Down Expand Up @@ -197,8 +201,8 @@ setNonEnumerableReadOnly( EagerEvaluator.prototype, 'isSideEffectFree', function
* Function which recursivly traverse from the node and tells weather node is side effect free or not.
*
* @private
* @param {JSON} node - ast node.
* @returns {Boolean} - Boolean indicate weather node is side effect free or not.
* @param {Object} node - ast node
* @returns {Boolean} - boolean indicating whether the node is side effect free or not
*/
function traverse(node) {
var fname;
Expand Down Expand Up @@ -238,7 +242,7 @@ setNonEnumerableReadOnly( EagerEvaluator.prototype, 'isSideEffectFree', function
* Get the underscore seprate function name for the member function call.
*
* @private
* @param {JSON} node - ast node
* @param {Object} node - ast node
* @returns {string} - underscore seprated function name for the member function call
*/
function getFunctionName( node ) {
Expand Down
7 changes: 0 additions & 7 deletions lib/node_modules/@stdlib/repl/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,6 @@ function REPL( options ) {
// Initialize an internal flag indicating whether we've received a `SIGINT` signal:
setNonEnumerable( this, '_SIGINT', false );

// Initialize an internal flag indicating whether command is eagerlyEvaluated:
setNonEnumerable( this, '_isEagerEvaluated', false );

// Initialize as internal variable for caching the compiled object from eagerEvaluation
setNonEnumerable( this, '_eagerEvaluatedExecutable', void 0 );

// Initialize an internal variable for caching the result of the last successfully evaluated command:
setNonEnumerable( this, '_ans', void 0 );

Expand Down Expand Up @@ -380,7 +374,6 @@ function REPL( options ) {
self._autoCloser.beforeKeypress( data, key );
completed = self._previewCompleter.beforeKeypress( data, key );
FLG = self._editorActions.beforeKeypress( data, key );

self._eagerEvaluator.beforeKeypress( data, key );

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

0 comments on commit 7fce9d3

Please sign in to comment.