Skip to content

this get lost in try block #35

@shankerwangmiao

Description

@shankerwangmiao
 a={}
  a.b=(cb)->
    console.log this
    try
      console.log this
      this.b cont()
    catch err
      console.error err
  a.b()

the output code is

(function () {
  var a;
  a = {};
  a.b = function (cb) {
    var err;
    console.log(this);
    (function (_$cont) {
      try {
        console.log(this);
        return this.b(function (arguments) {
          try {
            _$cont();
          } catch (_$err) {
            _$cont(_$err);
          }
        }.bind(this, arguments));
      } catch (_$err) {
        _$cont(_$err);
      }
    }(function (_error) {
      if (_error !== undefined) {
        err = _error;
        return console.error(err);
      }
    }));
  };
  a.b();
}.call(this));
/* Generated by Continuation.js v0.1.7 */

Apparently, this get lost in the structure

(function (_$cont) {
  //...
})(function (_error) {
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions