Compare commits

..

10 Commits

Author SHA1 Message Date
Simon Lydell
7b9fbf2c76 Merge pull request #4327 from lydell/1.11.1
1.11.1
2016-10-02 18:21:28 +02:00
Simon Lydell
8623792bcd CoffeeScript 1.11.1 2016-10-01 20:58:53 +02:00
Simon Lydell
809634ba39 Add changelog for version 1.11.1 2016-10-01 20:55:23 +02:00
Simon Lydell
46841d916d Fix shorthands after interpolated key in objects
Fixes #4324.
2016-09-29 19:02:00 +02:00
Simon Lydell
0b2d852f67 Merge pull request #4322 from fliptheweb/patch-1
Fix minor typo in changelog for 1.11.0
2016-09-26 20:04:33 +02:00
Artur Kornakov
964a588e29 Fix minor typo in changelog for 1.11.0 2016-09-26 20:37:37 +03:00
Simon Lydell
568a0c7b4e Fix indentation-stripping in """ strings
`"""` (and `"`) strings are lexed into an array of tokens, consisting of
strings and interpolations. Previously, the minimum indententation
inside `"""` strings was stripped from the beginning of _all_ of those
string tokens. Usually, the indentation is longer than any other
sequence of spaces in a `"""` string, so the problem didn't occur in
most cases. This commit makes sure to only strip indentation after
newlines.

Fixes #4314.
2016-09-26 17:14:31 +02:00
Simon Lydell
57f5297714 Handle very large hexadecimal number literals correctly
Very large decimal number literals, binary number literals and octal
literals are lexed into an INFINITY token (instead of a NUMBER token)
and compiled into `2e308`. That is is supposed to be the case for very
large hexdecimal dumber literals as well, but previously wasn't.

Before:

    $ node -p 'require("./").tokens(`0x${Array(256 + 1).join("f")}`)[0][0]'
    NUMBER

After:

    $ node -p 'require("./").tokens(`0x${Array(256 + 1).join("f")}`)[0][0]'
    INFINITY

This commit also cleans up `numberToken` in lexer.coffee a bit.
2016-09-26 16:33:57 +02:00
Simon Lydell
32041806ae Fix isLiteralArguments
`isLiteralArguments` mistakenly looked at `Literal`s instead of
`IdentifierLiteral`s.

This also gets rid of the ugly `.asKey` hack in nodes.coffee.

Fixes #4320.
2016-09-26 15:33:44 +02:00
Simon Lydell
b0d8fca245 Update the changelog for 1.11.0
Fixes #4321.
2016-09-26 15:09:53 +02:00
75 changed files with 247 additions and 152 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "coffee-script",
"version": "1.11.0",
"version": "1.11.1",
"main": [
"lib/coffee-script/coffee-script.js"
],

View File

@@ -144,7 +144,7 @@ SourceMap = <span class="hljs-built_in">require</span> <span class="hljs-str
</div>
<div class="content"><div class='highlight'><pre>exports.VERSION = <span class="hljs-string">'1.11.0'</span>
<div class="content"><div class='highlight'><pre>exports.VERSION = <span class="hljs-string">'1.11.1'</span>
exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>

View File

@@ -459,25 +459,30 @@ Be careful not to interfere with ranges-in-progress.</p>
<div class="content"><div class='highlight'><pre> numberToken: <span class="hljs-function">-&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span> <span class="hljs-keyword">unless</span> match = NUMBER.exec @chunk
number = match[<span class="hljs-number">0</span>]
lexedLength = number.length
<span class="hljs-keyword">if</span> <span class="hljs-regexp">/^0[BOX]/</span>.test number
@error <span class="hljs-string">"radix prefix in '<span class="hljs-subst">#{number}</span>' must be lowercase"</span>, offset: <span class="hljs-number">1</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-regexp">/E/</span>.test(number) <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> <span class="hljs-regexp">/^0x/</span>.test number
@error <span class="hljs-string">"exponential notation in '<span class="hljs-subst">#{number}</span>' must be indicated with a lowercase 'e'"</span>,
offset: number.indexOf(<span class="hljs-string">'E'</span>)
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-regexp">/^0\d*[89]/</span>.test number
@error <span class="hljs-string">"decimal literal '<span class="hljs-subst">#{number}</span>' must not be prefixed with '0'"</span>, length: lexedLength
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> <span class="hljs-regexp">/^0\d+/</span>.test number
@error <span class="hljs-string">"octal literal '<span class="hljs-subst">#{number}</span>' must be prefixed with '0o'"</span>, length: lexedLength
<span class="hljs-keyword">if</span> octalLiteral = <span class="hljs-regexp">/^0o([0-7]+)/</span>.exec number
numberValue = parseInt(octalLiteral[<span class="hljs-number">1</span>], <span class="hljs-number">8</span>)
<span class="hljs-keyword">switch</span>
<span class="hljs-keyword">when</span> <span class="hljs-regexp">/^0[BOX]/</span>.test number
@error <span class="hljs-string">"radix prefix in '<span class="hljs-subst">#{number}</span>' must be lowercase"</span>, offset: <span class="hljs-number">1</span>
<span class="hljs-keyword">when</span> <span class="hljs-regexp">/^(?!0x).*E/</span>.test number
@error <span class="hljs-string">"exponential notation in '<span class="hljs-subst">#{number}</span>' must be indicated with a lowercase 'e'"</span>,
offset: number.indexOf(<span class="hljs-string">'E'</span>)
<span class="hljs-keyword">when</span> <span class="hljs-regexp">/^0\d*[89]/</span>.test number
@error <span class="hljs-string">"decimal literal '<span class="hljs-subst">#{number}</span>' must not be prefixed with '0'"</span>, length: lexedLength
<span class="hljs-keyword">when</span> <span class="hljs-regexp">/^0\d+/</span>.test number
@error <span class="hljs-string">"octal literal '<span class="hljs-subst">#{number}</span>' must be prefixed with '0o'"</span>, length: lexedLength
base = <span class="hljs-keyword">switch</span> number.charAt <span class="hljs-number">1</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'b'</span> <span class="hljs-keyword">then</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'o'</span> <span class="hljs-keyword">then</span> <span class="hljs-number">8</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'x'</span> <span class="hljs-keyword">then</span> <span class="hljs-number">16</span>
<span class="hljs-keyword">else</span> <span class="hljs-literal">null</span>
numberValue = <span class="hljs-keyword">if</span> base? <span class="hljs-keyword">then</span> parseInt(number[<span class="hljs-number">2.</span>.], base) <span class="hljs-keyword">else</span> parseFloat(number)
<span class="hljs-keyword">if</span> number.charAt(<span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> [<span class="hljs-string">'b'</span>, <span class="hljs-string">'o'</span>]
number = <span class="hljs-string">"0x<span class="hljs-subst">#{numberValue.toString <span class="hljs-number">16</span>}</span>"</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> binaryLiteral = <span class="hljs-regexp">/^0b([01]+)/</span>.exec number
numberValue = parseInt(binaryLiteral[<span class="hljs-number">1</span>], <span class="hljs-number">2</span>)
number = <span class="hljs-string">"0x<span class="hljs-subst">#{numberValue.toString <span class="hljs-number">16</span>}</span>"</span>
<span class="hljs-keyword">else</span>
numberValue = parseFloat(number)
tag = <span class="hljs-keyword">if</span> numberValue <span class="hljs-keyword">is</span> Infinity <span class="hljs-keyword">then</span> <span class="hljs-string">'INFINITY'</span> <span class="hljs-keyword">else</span> <span class="hljs-string">'NUMBER'</span>
@token tag, number, <span class="hljs-number">0</span>, lexedLength
lexedLength</pre></div></div>
@@ -548,12 +553,12 @@ properly tag the <code>from</code>.</p>
<span class="hljs-keyword">while</span> match = HEREDOC_INDENT.exec doc
attempt = match[<span class="hljs-number">1</span>]
indent = attempt <span class="hljs-keyword">if</span> indent <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span> <span class="hljs-keyword">or</span> <span class="hljs-number">0</span> &lt; attempt.length &lt; indent.length
indentRegex = <span class="hljs-regexp">/// ^<span class="hljs-subst">#{indent}</span> ///</span>gm <span class="hljs-keyword">if</span> indent
indentRegex = <span class="hljs-regexp">/// \n<span class="hljs-subst">#{indent}</span> ///</span>g <span class="hljs-keyword">if</span> indent
@mergeInterpolationTokens tokens, {delimiter}, <span class="hljs-function"><span class="hljs-params">(value, i)</span> =&gt;</span>
value = @formatString value
value = value.replace indentRegex, <span class="hljs-string">'\n'</span> <span class="hljs-keyword">if</span> indentRegex
value = value.replace LEADING_BLANK_LINE, <span class="hljs-string">''</span> <span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
value = value.replace TRAILING_BLANK_LINE, <span class="hljs-string">''</span> <span class="hljs-keyword">if</span> i <span class="hljs-keyword">is</span> $
value = value.replace indentRegex, <span class="hljs-string">''</span> <span class="hljs-keyword">if</span> indentRegex
value
<span class="hljs-keyword">else</span>
@mergeInterpolationTokens tokens, {delimiter}, <span class="hljs-function"><span class="hljs-params">(value, i)</span> =&gt;</span>

View File

@@ -1757,7 +1757,6 @@ an access into the objects prototype.</p>
<div class="content"><div class='highlight'><pre>exports.Access = <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Access</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Base</span></span>
constructor: <span class="hljs-function"><span class="hljs-params">(@name, tag)</span> -&gt;</span>
@name.asKey = <span class="hljs-literal">yes</span>
@soak = tag <span class="hljs-keyword">is</span> <span class="hljs-string">'soak'</span>
children: [<span class="hljs-string">'name'</span>]
@@ -2162,13 +2161,13 @@ is the index of the beginning.</p>
<span class="hljs-keyword">if</span> i &lt; dynamicIndex
<span class="hljs-keyword">if</span> prop <span class="hljs-keyword">not</span> <span class="hljs-keyword">instanceof</span> Assign
prop = <span class="hljs-keyword">new</span> Assign prop, prop, <span class="hljs-string">'object'</span>
(prop.variable.base <span class="hljs-keyword">or</span> prop.variable).asKey = <span class="hljs-literal">yes</span>
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">if</span> prop <span class="hljs-keyword">instanceof</span> Assign
key = prop.variable
value = prop.value
<span class="hljs-keyword">else</span>
[key, value] = prop.base.cache o
key = <span class="hljs-keyword">new</span> PropertyName key.value <span class="hljs-keyword">if</span> key <span class="hljs-keyword">instanceof</span> IdentifierLiteral
prop = <span class="hljs-keyword">new</span> Assign (<span class="hljs-keyword">new</span> Value (<span class="hljs-keyword">new</span> IdentifierLiteral oref), [<span class="hljs-keyword">new</span> Access key]), value
<span class="hljs-keyword">if</span> indent <span class="hljs-keyword">then</span> answer.push @makeCode indent
answer.push prop.compileToFragments(o, LEVEL_TOP)...
@@ -4974,10 +4973,10 @@ SIMPLENUM = <span class="hljs-regexp">/^[+-]?\d+$/</span></pre></div></div>
code.replace <span class="hljs-regexp">/\s+$/</span>, <span class="hljs-string">''</span>
<span class="hljs-function">
<span class="hljs-title">isLiteralArguments</span> = <span class="hljs-params">(node)</span> -&gt;</span>
node <span class="hljs-keyword">instanceof</span> Literal <span class="hljs-keyword">and</span> node.value <span class="hljs-keyword">is</span> <span class="hljs-string">'arguments'</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> node.asKey
node <span class="hljs-keyword">instanceof</span> IdentifierLiteral <span class="hljs-keyword">and</span> node.value <span class="hljs-keyword">is</span> <span class="hljs-string">'arguments'</span>
<span class="hljs-function">
<span class="hljs-title">isLiteralThis</span> = <span class="hljs-params">(node)</span> -&gt;</span>
(node <span class="hljs-keyword">instanceof</span> ThisLiteral <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> node.asKey) <span class="hljs-keyword">or</span>
node <span class="hljs-keyword">instanceof</span> ThisLiteral <span class="hljs-keyword">or</span>
(node <span class="hljs-keyword">instanceof</span> Code <span class="hljs-keyword">and</span> node.bound) <span class="hljs-keyword">or</span>
node <span class="hljs-keyword">instanceof</span> SuperCall
<span class="hljs-function">

View File

@@ -112,7 +112,7 @@
<p>
<b>Latest Version:</b>
<a href="http://github.com/jashkenas/coffeescript/tarball/1.11.0">1.11.0</a>
<a href="http://github.com/jashkenas/coffeescript/tarball/1.11.1">1.11.1</a>
</p>
<pre>npm install -g coffee-script</pre>
@@ -1270,6 +1270,26 @@ Block
Change Log
</h2>
<p>
<%= releaseHeader('2016-10-02', '1.11.1', '1.11.0') %>
<ul>
<li>
Bugfix for shorthand object syntax after interpolated keys.
</li>
<li>
Bugfix for indentation-stripping in <code>"""</code> strings.
</li>
<li>
Bugfix for not being able to use the name "arguments" for a prototype
property of class.
</li>
<li>
Correctly compile large hexadecimal numbers literals to
<code>2e308</code> (just like all other large number literals do).
</li>
</ul>
</p>
<p>
<%= releaseHeader('2016-09-24', '1.11.0', '1.10.0') %>
<ul>
@@ -1312,6 +1332,11 @@ six = -&gt;
</li>
</ul>
</li>
<li>
<code>&amp;&amp;=</code>, <code>||=</code>, <code>and=</code> and
<code>or=</code> no longer accidentally allow a space before the
equals sign.
</li>
<li>
Improved several error messages.
</li>
@@ -1321,7 +1346,7 @@ six = -&gt;
<code>Infinity</code> into <code>2e308</code>.
</li>
<li>
Bugfix for renamed destrucured parameters with defaults.
Bugfix for renamed destructured parameters with defaults.
<code>({a: b = 1}) -&gt;</code> no longer crashes the compiler.
</li>
<li>

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var volume, winner;
if (ignition === true) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var courses, dish, food, foods, i, j, k, l, len, len1, len2, ref;
ref = ['toast', 'cheese', 'wine'];

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
/*
SkinnyMochaHalfCaffScript Compiler v1.0

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var fs;
fs = require('fs');

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
$('body').click(function(e) {
return $('.box').fadeIn('fast').addClass('.active');
}).css('background', 'white');

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var Animal, Horse, Snake, sam, tom,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var cholesterol, healthy;
cholesterol = 127;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var date, mood;
if (singing) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var Person, tim;
Person = (function() {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var fill;
fill = function(container, liquid) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var filename, fn, i, len;
fn = function(filename) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var hi;
hi = function() {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var footprints, solipsism, speed;
if ((typeof mind !== "undefined" && mind !== null) && (typeof world === "undefined" || world === null)) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var first, last, ref, text;
text = "Every literary critic believes he will outwit history and have the last word";

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var eldest, grade;
grade = function(student) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var one, six, three, two;
six = (one = 1) + (two = 2) + (three = 3);

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var globals, name;
globals = ((function() {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var error;
alert((function() {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var Account;
Account = function(customer, cart) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var cube, square;
square = function(x) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var perfectSquares;
perfectSquares = function*() {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var html;
html = "<strong>\n cup of coffeescript\n</strong>";

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var OPERATOR;
OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var author, quote, sentence;
author = "Wittgenstein";

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
import 'local-file.coffee';
import 'coffee-script';

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var modulo = function(a, b) { return (+a % (b = +b) + b) % b; };
-7 % 5 === -2;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var city, forecast, ref, temp, weatherReport;
weatherReport = function(location) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var age, ages, child, yearsOld;
yearsOld = {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var city, futurists, name, ref, ref1, street;
futurists = {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var bitlist, kids, singers, song;
song = ["do", "re", "mi", "fa", "so"];

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
$('.account').attr({
"class": 'active'
});

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var cubes, list, math, num, number, opposite, race, square,
slice = [].slice;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var ref, theBait, theSwitch;
theBait = 1000;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var close, contents, i, open, ref, tag,
slice = [].slice;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
String.prototype.dasherize = function() {
return this.replace(/_/g, "-");
};

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var countdown, num;
countdown = (function() {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var changeNumbers, inner, outer;
outer = 1;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var copy, end, middle, numbers, start;
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var ref, zip;
zip = typeof lottery.drawWinner === "function" ? (ref = lottery.drawWinner().address) != null ? ref.zipcode : void 0 : void 0;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var awardMedals, contenders, gold, rest, silver,
slice = [].slice;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var numbers, ref;
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var mobyDick;
mobyDick = "Call me Ishmael. Some years ago -- never mind how long precisely -- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world...";

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
switch (day) {
case "Mon":
go(work);

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var grade, score;
score = 76;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var error;
try {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
var lyrics, num;
if (this.studyingEconomics) {

File diff suppressed because one or more lines are too long

View File

@@ -112,7 +112,7 @@
<p>
<b>Latest Version:</b>
<a href="http://github.com/jashkenas/coffeescript/tarball/1.11.0">1.11.0</a>
<a href="http://github.com/jashkenas/coffeescript/tarball/1.11.1">1.11.1</a>
</p>
<pre>npm install -g coffee-script</pre>
@@ -2596,6 +2596,30 @@ task(<span class="string">'build:parser'</span>, <span class="string">'rebuild t
Change Log
</h2>
<p>
<div class="anchor" id="1.11.1"></div>
<b class="header">
<a href="https://github.com/jashkenas/coffeescript/compare/1.11.0...1.11.1">1.11.1</a>
<span class="timestamp"> &mdash; <time datetime="2016-10-02">October 2, 2016</time></span>
</b>
<ul>
<li>
Bugfix for shorthand object syntax after interpolated keys.
</li>
<li>
Bugfix for indentation-stripping in <code>"""</code> strings.
</li>
<li>
Bugfix for not being able to use the name "arguments" for a prototype
property of class.
</li>
<li>
Correctly compile large hexadecimal numbers literals to
<code>2e308</code> (just like all other large number literals do).
</li>
</ul>
</p>
<p>
<div class="anchor" id="1.11.0"></div>
<b class="header">
@@ -2642,6 +2666,11 @@ six = -&gt;
</li>
</ul>
</li>
<li>
<code>&amp;&amp;=</code>, <code>||=</code>, <code>and=</code> and
<code>or=</code> no longer accidentally allow a space before the
equals sign.
</li>
<li>
Improved several error messages.
</li>
@@ -2651,7 +2680,7 @@ six = -&gt;
<code>Infinity</code> into <code>2e308</code>.
</li>
<li>
Bugfix for renamed destrucured parameters with defaults.
Bugfix for renamed destructured parameters with defaults.
<code>({a: b = 1}) -&gt;</code> no longer crashes the compiler.
</li>
<li>

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var CoffeeScript, compile, runScripts,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, parser, path, ref, sourceMaps, vm, withPrettyErrors,
hasProp = {}.hasOwnProperty;
@@ -17,7 +17,7 @@
SourceMap = require('./sourcemap');
exports.VERSION = '1.11.0';
exports.VERSION = '1.11.1';
exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md'];

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, findDirectoryIndex, forkNode, fs, helpers, hidden, joinTimeout, makePrelude, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, ref, removeSource, removeSourceDir, silentUnlink, sourceCode, sources, spawn, timeLog, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var buildLocationData, extend, flatten, ref, repeat, syntaxErrorToString;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var key, ref, val;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HERECOMMENT_ILLEGAL, HEREDOC_DOUBLE, HEREDOC_INDENT, HEREDOC_SINGLE, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVALID_ESCAPE, INVERSES, JSTOKEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, isUnassignable, key, locationDataToString, ref, ref1, repeat, starts, throwSyntaxError,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
@@ -174,37 +174,48 @@
};
Lexer.prototype.numberToken = function() {
var binaryLiteral, lexedLength, match, number, numberValue, octalLiteral, tag;
var base, lexedLength, match, number, numberValue, ref2, tag;
if (!(match = NUMBER.exec(this.chunk))) {
return 0;
}
number = match[0];
lexedLength = number.length;
if (/^0[BOX]/.test(number)) {
this.error("radix prefix in '" + number + "' must be lowercase", {
offset: 1
});
} else if (/E/.test(number) && !/^0x/.test(number)) {
this.error("exponential notation in '" + number + "' must be indicated with a lowercase 'e'", {
offset: number.indexOf('E')
});
} else if (/^0\d*[89]/.test(number)) {
this.error("decimal literal '" + number + "' must not be prefixed with '0'", {
length: lexedLength
});
} else if (/^0\d+/.test(number)) {
this.error("octal literal '" + number + "' must be prefixed with '0o'", {
length: lexedLength
});
switch (false) {
case !/^0[BOX]/.test(number):
this.error("radix prefix in '" + number + "' must be lowercase", {
offset: 1
});
break;
case !/^(?!0x).*E/.test(number):
this.error("exponential notation in '" + number + "' must be indicated with a lowercase 'e'", {
offset: number.indexOf('E')
});
break;
case !/^0\d*[89]/.test(number):
this.error("decimal literal '" + number + "' must not be prefixed with '0'", {
length: lexedLength
});
break;
case !/^0\d+/.test(number):
this.error("octal literal '" + number + "' must be prefixed with '0o'", {
length: lexedLength
});
}
if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
numberValue = parseInt(octalLiteral[1], 8);
base = (function() {
switch (number.charAt(1)) {
case 'b':
return 2;
case 'o':
return 8;
case 'x':
return 16;
default:
return null;
}
})();
numberValue = base != null ? parseInt(number.slice(2), base) : parseFloat(number);
if ((ref2 = number.charAt(1)) === 'b' || ref2 === 'o') {
number = "0x" + (numberValue.toString(16));
} else if (binaryLiteral = /^0b([01]+)/.exec(number)) {
numberValue = parseInt(binaryLiteral[1], 2);
number = "0x" + (numberValue.toString(16));
} else {
numberValue = parseFloat(number);
}
tag = numberValue === 2e308 ? 'INFINITY' : 'NUMBER';
this.token(tag, number, 0, lexedLength);
@@ -256,22 +267,22 @@
}
}
if (indent) {
indentRegex = RegExp("^" + indent, "gm");
indentRegex = RegExp("\\n" + indent, "g");
}
this.mergeInterpolationTokens(tokens, {
delimiter: delimiter
}, (function(_this) {
return function(value, i) {
value = _this.formatString(value);
if (indentRegex) {
value = value.replace(indentRegex, '\n');
}
if (i === 0) {
value = value.replace(LEADING_BLANK_LINE, '');
}
if (i === $) {
value = value.replace(TRAILING_BLANK_LINE, '');
}
if (indentRegex) {
value = value.replace(indentRegex, '');
}
return value;
};
})(this));

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var Access, Arr, Assign, Base, Block, BooleanLiteral, Call, Class, Code, CodeFragment, Comment, Existence, Expansion, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, ExportSpecifierList, Extends, For, IdentifierLiteral, If, ImportClause, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, ImportSpecifierList, In, Index, InfinityLiteral, JS_FORBIDDEN, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, ModuleDeclaration, ModuleSpecifier, ModuleSpecifierList, NEGATE, NO, NaNLiteral, NullLiteral, NumberLiteral, Obj, Op, Param, Parens, PassthroughLiteral, PropertyName, Range, RegexLiteral, RegexWithInterpolations, Return, SIMPLENUM, Scope, Slice, Splat, StatementLiteral, StringLiteral, StringWithInterpolations, SuperCall, Switch, TAB, THIS, ThisLiteral, Throw, Try, UTILITIES, UndefinedLiteral, Value, While, YES, YieldReturn, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, isComplexOrAssignable, isLiteralArguments, isLiteralThis, isUnassignable, locationDataToString, merge, multident, ref1, ref2, some, starts, throwSyntaxError, unfoldSoak, utility,
extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
@@ -1241,7 +1241,6 @@
function Access(name1, tag) {
this.name = name1;
this.name.asKey = true;
this.soak = tag === 'soak';
}
@@ -1483,13 +1482,15 @@
if (!(prop instanceof Assign)) {
prop = new Assign(prop, prop, 'object');
}
(prop.variable.base || prop.variable).asKey = true;
} else {
if (prop instanceof Assign) {
key = prop.variable;
value = prop.value;
} else {
ref3 = prop.base.cache(o), key = ref3[0], value = ref3[1];
if (key instanceof IdentifierLiteral) {
key = new PropertyName(key.value);
}
}
prop = new Assign(new Value(new IdentifierLiteral(oref), [new Access(key)]), value);
}
@@ -3779,11 +3780,11 @@
};
isLiteralArguments = function(node) {
return node instanceof Literal && node.value === 'arguments' && !node.asKey;
return node instanceof IdentifierLiteral && node.value === 'arguments';
};
isLiteralThis = function(node) {
return (node instanceof ThisLiteral && !node.asKey) || (node instanceof Code && node.bound) || node instanceof SuperCall;
return node instanceof ThisLiteral || (node instanceof Code && node.bound) || node instanceof SuperCall;
};
isComplexOrAssignable = function(node) {

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, ref, replDefaults, runInContext, updateSyntaxError, vm;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, k, left, len, ref, rite,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var Scope,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.11.0
// Generated by CoffeeScript 1.11.1
(function() {
var LineMap, SourceMap;

View File

@@ -8,7 +8,7 @@
"compiler"
],
"author": "Jeremy Ashkenas",
"version": "1.11.0",
"version": "1.11.1",
"license": "MIT",
"engines": {
"node": ">=0.8.0"

View File

@@ -12,7 +12,7 @@ helpers = require './helpers'
SourceMap = require './sourcemap'
# The current CoffeeScript version number.
exports.VERSION = '1.11.0'
exports.VERSION = '1.11.1'
exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md']

View File

@@ -191,25 +191,30 @@ exports.Lexer = class Lexer
# Be careful not to interfere with ranges-in-progress.
numberToken: ->
return 0 unless match = NUMBER.exec @chunk
number = match[0]
lexedLength = number.length
if /^0[BOX]/.test number
@error "radix prefix in '#{number}' must be lowercase", offset: 1
else if /E/.test(number) and not /^0x/.test number
@error "exponential notation in '#{number}' must be indicated with a lowercase 'e'",
offset: number.indexOf('E')
else if /^0\d*[89]/.test number
@error "decimal literal '#{number}' must not be prefixed with '0'", length: lexedLength
else if /^0\d+/.test number
@error "octal literal '#{number}' must be prefixed with '0o'", length: lexedLength
if octalLiteral = /^0o([0-7]+)/.exec number
numberValue = parseInt(octalLiteral[1], 8)
switch
when /^0[BOX]/.test number
@error "radix prefix in '#{number}' must be lowercase", offset: 1
when /^(?!0x).*E/.test number
@error "exponential notation in '#{number}' must be indicated with a lowercase 'e'",
offset: number.indexOf('E')
when /^0\d*[89]/.test number
@error "decimal literal '#{number}' must not be prefixed with '0'", length: lexedLength
when /^0\d+/.test number
@error "octal literal '#{number}' must be prefixed with '0o'", length: lexedLength
base = switch number.charAt 1
when 'b' then 2
when 'o' then 8
when 'x' then 16
else null
numberValue = if base? then parseInt(number[2..], base) else parseFloat(number)
if number.charAt(1) in ['b', 'o']
number = "0x#{numberValue.toString 16}"
else if binaryLiteral = /^0b([01]+)/.exec number
numberValue = parseInt(binaryLiteral[1], 2)
number = "0x#{numberValue.toString 16}"
else
numberValue = parseFloat(number)
tag = if numberValue is Infinity then 'INFINITY' else 'NUMBER'
@token tag, number, 0, lexedLength
lexedLength
@@ -243,12 +248,12 @@ exports.Lexer = class Lexer
while match = HEREDOC_INDENT.exec doc
attempt = match[1]
indent = attempt if indent is null or 0 < attempt.length < indent.length
indentRegex = /// ^#{indent} ///gm if indent
indentRegex = /// \n#{indent} ///g if indent
@mergeInterpolationTokens tokens, {delimiter}, (value, i) =>
value = @formatString value
value = value.replace indentRegex, '\n' if indentRegex
value = value.replace LEADING_BLANK_LINE, '' if i is 0
value = value.replace TRAILING_BLANK_LINE, '' if i is $
value = value.replace indentRegex, '' if indentRegex
value
else
@mergeInterpolationTokens tokens, {delimiter}, (value, i) =>

View File

@@ -807,7 +807,6 @@ exports.Extends = class Extends extends Base
# an access into the object's prototype.
exports.Access = class Access extends Base
constructor: (@name, tag) ->
@name.asKey = yes
@soak = tag is 'soak'
children: ['name']
@@ -1014,13 +1013,13 @@ exports.Obj = class Obj extends Base
if i < dynamicIndex
if prop not instanceof Assign
prop = new Assign prop, prop, 'object'
(prop.variable.base or prop.variable).asKey = yes
else
if prop instanceof Assign
key = prop.variable
value = prop.value
else
[key, value] = prop.base.cache o
key = new PropertyName key.value if key instanceof IdentifierLiteral
prop = new Assign (new Value (new IdentifierLiteral oref), [new Access key]), value
if indent then answer.push @makeCode indent
answer.push prop.compileToFragments(o, LEVEL_TOP)...
@@ -2561,10 +2560,10 @@ multident = (code, tab) ->
code.replace /\s+$/, ''
isLiteralArguments = (node) ->
node instanceof Literal and node.value is 'arguments' and not node.asKey
node instanceof IdentifierLiteral and node.value is 'arguments'
isLiteralThis = (node) ->
(node instanceof ThisLiteral and not node.asKey) or
node instanceof ThisLiteral or
(node instanceof Code and node.bound) or
node instanceof SuperCall

View File

@@ -712,6 +712,11 @@ test "#2630: class bodies can't reference arguments", ->
throws ->
CoffeeScript.compile('class Test then arguments')
# #4320: Don't be too eager when checking, though.
class Test
arguments: 5
eq 5, Test::arguments
test "#2319: fn class n extends o.p [INDENT] x = 123", ->
first = ->

View File

@@ -569,3 +569,9 @@ test "object keys with interpolations", ->
interpolated:
nested:
123: 456
test "#4324: Shorthand after interpolated key", ->
a = 2
obj = {"#{1}": 1, a}
eq 1, obj[1]
eq 2, obj.a

View File

@@ -390,3 +390,13 @@ test "#3795: Escape otherwise invalid characters", ->
eq """#{a}""", 'a\u2029'
eq """#{a}\0\
1""", 'a\0' + '1'
test "#4314: Whitespace less than or equal to stripped indentation", ->
# The odd indentation is intentional here, to test 1-space indentation.
eq ' ', """
#{} #{}
"""
eq '1 2 3 4 5 end\na 0 b', """
#{1} #{2} #{3} #{4} #{5} end
a #{0} b"""