Permalink
Browse files

Allow rv.id(4).defer(x) to work as in tamejs

  • Loading branch information...
1 parent d2bc75b commit 71f34d7bde94b4521b5558026c0e813154748b13 maxtaco committed with Dec 6, 2011
Showing with 126 additions and 121 deletions.
  1. +2 −0 lib/coffee-script/grammar.js
  2. +1 −1 lib/coffee-script/lexer.js
  3. +1 −1 lib/coffee-script/nodes.js
  4. +119 −117 lib/coffee-script/parser.js
  5. +1 −0 src/grammar.coffee
  6. +1 −1 src/lexer.coffee
  7. +1 −1 src/nodes.coffee
@@ -173,6 +173,8 @@
Accessor: [
o('. Identifier', function() {
return new Access($2);
+ }), o('. Defer', function() {
+ return new Access($2);
}), o('?. Identifier', function() {
return new Access($2, 'soak');
}), o(':: Identifier', function() {
@@ -69,7 +69,7 @@
this.token('OWN', id);
return id.length;
}
- forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref3 = prev[0]) === '.' || _ref3 === '?.' || _ref3 === '::') || !prev.spaced && prev[0] === '@');
+ forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref3 = prev[0]) === '.' || _ref3 === '?.' || _ref3 === '::') || !prev.spaced && prev[0] === '@') && id !== 'defer';
tag = 'IDENTIFIER';
if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) {
tag = id.toUpperCase();
@@ -1052,7 +1052,7 @@
Access.prototype.compile = function(o) {
var name;
name = this.name.compile(o);
- if (IDENTIFIER.test(name)) {
+ if ((IDENTIFIER.test(name)) || (this.name instanceof Defer)) {
return "." + name;
} else {
return "[" + name + "]";
Oops, something went wrong.

0 comments on commit 71f34d7

Please sign in to comment.