spine / spine

Lightweight MVC library for building JavaScript applications

Home Page:http://spine.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not mix up instance property and local variable

webyom opened this issue · comments

This will make Spine broken with some version of coffeescript compiler. Please check Route constructor for below compiled result.

    function Route(_at_path, _at_callback) {
      var match, path;
      this.path = _at_path;
      this.callback = _at_callback;
      this.names = [];
      if (typeof path === 'string') {
        namedParam.lastIndex = 0;
        while ((match = namedParam.exec(path)) !== null) {
          this.names.push(match[1]);
        }
        splatParam.lastIndex = 0;
        while ((match = splatParam.exec(path)) !== null) {
          this.names.push(match[1]);
        }
        path = path.replace(escapeRegExp, '\\$&').replace(namedParam, '([^\/]*)').replace(splatParam, '(.*?)');
        this.route = new RegExp("^" + path + "$");
      } else {
        this.route = path;
      }
    }

As a result, this.route will be undefined.

More than one mouth passed, nobody follow up this issue. I guess this project has been dead.

it's not dead :)

I just didn't understand your issue clearly, and since "broken with some version of coffeescript compiler" didn't register as specific enough or important enough to give it priority I brushed it off. If you have more details to help me out or possibly a suggestion on how to fix I welcome that!

@aeischeid you may use nodejs package coffee-script@1.9.1 to compile it, or read the code I pasted carefully. The "path" variable will be always undefined.

I will look into this and get something out soon to fix it. Thanks for the heads up.

Sorry, forgot to mention that my Spine version is 1.2.2, not sure whether the newest version has the same issue.