<commit_before>'use strict';

const Stream = SYS.use('stream/Stream');
const Handler = SYS.use('handler/Handler');

module.exports = class StreamLine {

  constructor(stream) {
    this._stream = stream;
    this._handler = new Handler(this, stream.handler());
    this._pipe = stream._pipe;
    this._vars = null;

    this._index = 0;
  }

  handler() {
    return this._handler;
  }

  run() {
    this._vars = this._stream.args(SYS.args(arguments));
    this.handler().trigger('run').next();
  }

  next() {
    if (this._index < this._pipe.length) {
      this.call(this._index++);
    }
  }

  vars() {
    return this._vars;
  }

  call(index = null) {
    if (index == null) index = this._index;

    this.handler().trigger('call', index);
    this._pipe[index].apply(this, this._vars);
  }

  callback(callback) {
    var pipe = this;

    return function() {
      return SYS.passOn(pipe, callback, arguments);
    };
  }

}<commit_msg>add context<commit_after>'use strict';

const Stream = SYS.use('stream/Stream');
const Handler = SYS.use('handler/Handler');

module.exports = class StreamLine {

  constructor(stream) {
    this._stream = stream;
    this._handler = new Handler(this, stream.handler());
    this._pipe = stream._pipe;
    this._vars = null;

    this._index = 0;
    this._context = null;
  }

  handler() {
    return this._handler;
  }

  run() {
    this._vars = this._stream.args(SYS.args(arguments));
    this.handler().trigger('run').next();
  }

  context() {
    return this._context;
  }

  next() {
    this._context = null;
    if (this._index < this._pipe.length) {
      this.call(this._index++);
    }
  }

  vars() {
    return this._vars;
  }

  call(index = null) {
    if (index == null) index = this._index;

    this.handler().trigger('call', index);
    this._pipe[index].apply(this, this._vars);
  }

  callback(callback) {
    var pipe = this;

    return function() {
      pipe._context = this;
      return SYS.passOn(pipe, callback, arguments);
    };
  }

}
{'fraction_non_alphanumeric': 0.16327543424317617, 'fraction_numerical': 0.0009925558312655087, 'mean_word_length': 2.7541899441340782, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '345367', 'n_tokens_mistral': 688, 'n_tokens_neox': 659, 'n_words': 130}