I suppose there's no reason to ever call a prototype like a function.

This commit is contained in:
Timothy Jones 2011-01-22 19:34:30 +13:00
parent 06b0c7e928
commit 15e1078d01
3 changed files with 7 additions and 7 deletions

View File

@ -37,7 +37,7 @@
return (new Rewriter).rewrite(this.tokens);
};
Lexer.prototype.identifierToken = function() {
var colon, forcedIdentifier, id, input, match, prev, tag, _ref, _ref2, _ref3;
var colon, forcedIdentifier, id, input, match, prev, tag, _ref, _ref2;
if (!(match = IDENTIFIER.exec(this.chunk))) {
return 0;
}
@ -46,11 +46,11 @@
this.token('OWN', id);
return id.length;
}
forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref = prev[0]) === '.' || _ref === '?.') || !prev.spaced && ((_ref2 = prev[0]) === '@' || _ref2 === '::'));
forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref = prev[0]) === '.' || _ref === '?.' || _ref === '::') || !prev.spaced && prev[0] === '@');
tag = 'IDENTIFIER';
if (__indexOf.call(JS_KEYWORDS, id) >= 0 || !forcedIdentifier && __indexOf.call(COFFEE_KEYWORDS, id) >= 0) {
tag = id.toUpperCase();
if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) {
if (tag === 'WHEN' && (_ref2 = this.tag(), __indexOf.call(LINE_BREAK, _ref2) >= 0)) {
tag = 'LEADING_WHEN';
} else if (tag === 'FOR') {
this.seenFor = true;

View File

@ -80,8 +80,8 @@ exports.Lexer = class Lexer
@token 'OWN', id
return id.length
forcedIdentifier = colon or
(prev = last @tokens) and (prev[0] in ['.', '?.'] or
not prev.spaced and prev[0] in ['@', '::'])
(prev = last @tokens) and (prev[0] in ['.', '?.', '::'] or
not prev.spaced and prev[0] is '@')
tag = 'IDENTIFIER'
if id in JS_KEYWORDS or

View File

@ -75,8 +75,8 @@ test "`?.` and `::` should continue lines", ->
doesNotThrow -> CoffeeScript.compile """
oh. yes
oh. true
oh . return
oh?. true
oh:: return
"""
# Array Literals