Compare commits

..

2 Commits
1.3.0 ... 1.3.1

Author SHA1 Message Date
Jeremy Ashkenas
60c9b94656 CoffeeScript 1.3.1 (quick bugfix for compound assignment to a global variable 2012-04-10 17:26:23 -04:00
Jeremy Ashkenas
f0e17fc20f fixing compound assignments to global variables. oof. 2012-04-10 17:07:38 -04:00
62 changed files with 79 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
###
CoffeeScript Compiler v1.3.0
CoffeeScript Compiler v1.3.1
Released under the MIT License
###

View File

@@ -13,7 +13,7 @@ execute all scripts present in <code>text/coffeescript</code> tags.</p>
<span class="nv">content = </span><span class="nx">compile</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">filename</span><span class="p">,</span> <span class="s1">&#39;utf8&#39;</span><span class="p">),</span> <span class="p">{</span><span class="nx">filename</span><span class="p">}</span>
<span class="nx">module</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">content</span><span class="p">,</span> <span class="nx">filename</span>
<span class="k">else</span> <span class="k">if</span> <span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span>
<span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span> <span class="s1">&#39;.coffee&#39;</span><span class="p">,</span> <span class="nf">(content) -&gt;</span> <span class="nx">compile</span> <span class="nx">content</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>The current CoffeeScript version number.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.VERSION = </span><span class="s1">&#39;1.3.0&#39;</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Words that cannot be used as identifiers in CoffeeScript code</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Expose helpers for testing.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
<span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span> <span class="s1">&#39;.coffee&#39;</span><span class="p">,</span> <span class="nf">(content) -&gt;</span> <span class="nx">compile</span> <span class="nx">content</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>The current CoffeeScript version number.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.VERSION = </span><span class="s1">&#39;1.3.1&#39;</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Words that cannot be used as identifiers in CoffeeScript code</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Expose helpers for testing.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
compiler.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.compile = compile = </span><span class="nf">(code, options = {}) -&gt;</span>
<span class="p">{</span><span class="nx">merge</span><span class="p">}</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">.</span><span class="nx">helpers</span>
<span class="k">try</span>

View File

@@ -850,7 +850,8 @@ for details.</p> </td> <td class="code"> <
<span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">level</span> <span class="o">&lt;</span> <span class="nx">LEVEL_LIST</span> <span class="k">then</span> <span class="nx">code</span> <span class="k">else</span> <span class="s2">&quot;(#{code})&quot;</span></pre></div> </td> </tr> <tr id="section-96"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-96">&#182;</a> </div> <p>When compiling a conditional assignment, take care to ensure that the
operands are only evaluated once, even though we have to reference them
more than once.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">compileConditional: </span><span class="nf">(o) -&gt;</span>
<span class="p">[</span><span class="nx">left</span><span class="p">,</span> <span class="nx">right</span><span class="p">]</span> <span class="o">=</span> <span class="nx">@variable</span><span class="p">.</span><span class="nx">cacheReference</span> <span class="nx">o</span></pre></div> </td> </tr> <tr id="section-97"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-97">&#182;</a> </div> <p>Disallow conditional assignment of undefined variables.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="nx">left</span><span class="p">.</span><span class="nx">base</span> <span class="k">instanceof</span> <span class="nx">Literal</span> <span class="o">and</span> <span class="nx">left</span><span class="p">.</span><span class="nx">base</span><span class="p">.</span><span class="nx">value</span> <span class="o">!=</span> <span class="s2">&quot;this&quot;</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">o</span><span class="p">.</span><span class="nx">scope</span><span class="p">.</span><span class="nx">check</span> <span class="nx">left</span><span class="p">.</span><span class="nx">base</span><span class="p">.</span><span class="nx">value</span>
<span class="p">[</span><span class="nx">left</span><span class="p">,</span> <span class="nx">right</span><span class="p">]</span> <span class="o">=</span> <span class="nx">@variable</span><span class="p">.</span><span class="nx">cacheReference</span> <span class="nx">o</span></pre></div> </td> </tr> <tr id="section-97"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-97">&#182;</a> </div> <p>Disallow conditional assignment of undefined variables.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="o">not</span> <span class="nx">left</span><span class="p">.</span><span class="nx">properties</span><span class="p">.</span><span class="nx">length</span> <span class="o">and</span> <span class="nx">left</span><span class="p">.</span><span class="nx">base</span> <span class="k">instanceof</span> <span class="nx">Literal</span> <span class="o">and</span>
<span class="nx">left</span><span class="p">.</span><span class="nx">base</span><span class="p">.</span><span class="nx">value</span> <span class="o">!=</span> <span class="s2">&quot;this&quot;</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">o</span><span class="p">.</span><span class="nx">scope</span><span class="p">.</span><span class="nx">check</span> <span class="nx">left</span><span class="p">.</span><span class="nx">base</span><span class="p">.</span><span class="nx">value</span>
<span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span> <span class="s2">&quot;the variable \&quot;#{left.base.value}\&quot; can&#39;t be assigned with #{@context} because it has not been defined.&quot;</span>
<span class="k">if</span> <span class="s2">&quot;?&quot;</span> <span class="k">in</span> <span class="nx">@context</span> <span class="k">then</span> <span class="nv">o.isExistentialEquals = </span><span class="kc">true</span>
<span class="k">new</span> <span class="nx">Op</span><span class="p">(</span><span class="nx">@context</span><span class="p">[...</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="nx">left</span><span class="p">,</span> <span class="k">new</span> <span class="nx">Assign</span><span class="p">(</span><span class="nx">right</span><span class="p">,</span> <span class="nx">@value</span><span class="p">,</span> <span class="s1">&#39;=&#39;</span><span class="p">)</span> <span class="p">).</span><span class="nx">compile</span> <span class="nx">o</span></pre></div> </td> </tr> <tr id="section-98"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-98">&#182;</a> </div> <p>Compile the assignment from an array splice literal, using JavaScript's

View File

@@ -135,7 +135,7 @@
<p>
<b>Latest Version:</b>
<a href="http://github.com/jashkenas/coffee-script/tarball/1.3.0">1.3.0</a>
<a href="http://github.com/jashkenas/coffee-script/tarball/1.3.1">1.3.1</a>
</p>
<h2>
@@ -1105,7 +1105,7 @@ Expressions
<p>
<b class="header" style="margin-top: 20px;">
<a href="https://github.com/jashkenas/coffee-script/compare/1.2.0...1.3.0">1.3.0</a>
<a href="https://github.com/jashkenas/coffee-script/compare/1.2.0...1.3.1">1.3.1</a>
<span class="timestamp"> &ndash; <small>April 10, 2012</small></span>
</b>
<ul>

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var courses, dish, food, foods, i, _i, _j, _k, _len, _len1, _len2, _ref;
_ref = ['toast', 'cheese', 'wine'];

View File

@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
/*
CoffeeScript Compiler v1.3.0
CoffeeScript Compiler v1.3.1
Released under the MIT License
*/

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var Animal, Horse, Snake, sam, tom,
__hasProp = {}.hasOwnProperty,
__extends = 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; };

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var filename, _fn, _i, _len;
_fn = function(filename) {

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.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.3.0
// Generated by CoffeeScript 1.3.1
var eldest, grade;
grade = function(student) {

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
alert((function() {
try {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var city, forecast, temp, weatherReport, _ref;
weatherReport = function(location) {

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var city, futurists, name, street, _ref, _ref1;
futurists = {

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
$('.account').attr({
"class": 'active'

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var theBait, theSwitch, _ref;
theBait = 1000;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
var close, contents, open, tag, _i, _ref,
__slice = [].slice;

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.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.3.0
// Generated by CoffeeScript 1.3.1
var zip, _ref;
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.3.0
// Generated by CoffeeScript 1.3.1
var awardMedals, contenders, gold, rest, silver,
__slice = [].slice;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.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.3.0
// Generated by CoffeeScript 1.3.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.3.0
// Generated by CoffeeScript 1.3.1
switch (day) {
case "Mon":

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
try {
allHellBreaksLoose();

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.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/coffee-script/tarball/1.3.0">1.3.0</a>
<a href="http://github.com/jashkenas/coffee-script/tarball/1.3.1">1.3.1</a>
</p>
<h2>
@@ -1998,18 +1998,18 @@ html = "<strong>\n cup of coffeescript\n</strong>";
are preserved in the generated code.
</p>
<div class='code'><pre class="idle"><span class="Comment"><span class="Comment">###</span></span>
<span class="Comment">CoffeeScript Compiler v1.3.0</span>
<span class="Comment">CoffeeScript Compiler v1.3.1</span>
<span class="Comment">Released under the MIT License</span>
<span class="Comment"><span class="Comment">###</span></span>
</pre><pre class="idle"><span class="Comment"><span class="Comment">/*</span></span>
<span class="Comment">CoffeeScript Compiler v1.3.0</span>
<span class="Comment">CoffeeScript Compiler v1.3.1</span>
<span class="Comment">Released under the MIT License</span>
<span class="Comment"><span class="Comment">*/</span></span>
</pre><script>window.example37 = "###\nCoffeeScript Compiler v1.3.0\nReleased under the MIT License\n###\n\n\n"</script><div class='minibutton load' onclick='javascript: loadConsole(example37);'>load</div><br class='clear' /></div>
</pre><script>window.example37 = "###\nCoffeeScript Compiler v1.3.1\nReleased under the MIT License\n###\n\n\n"</script><div class='minibutton load' onclick='javascript: loadConsole(example37);'>load</div><br class='clear' /></div>
<p>
<span id="regexes" class="bookmark"></span>
@@ -2287,7 +2287,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
<p>
<b class="header" style="margin-top: 20px;">
<a href="https://github.com/jashkenas/coffee-script/compare/1.2.0...1.3.0">1.3.0</a>
<a href="https://github.com/jashkenas/coffee-script/compare/1.2.0...1.3.1">1.3.1</a>
<span class="timestamp"> &ndash; <small>April 10, 2012</small></span>
</b>
<ul>

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var CoffeeScript, runScripts;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.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.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var Lexer, RESERVED, compile, fs, lexer, parser, path, vm, _ref,
__hasProp = {}.hasOwnProperty;
@@ -27,7 +27,7 @@
});
}
exports.VERSION = '1.3.0';
exports.VERSION = '1.3.1';
exports.RESERVED = RESERVED;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref;

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var extend, flatten;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var key, val, _ref;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1,
__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.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, unfoldSoak, utility, _ref, _ref1,
__hasProp = {}.hasOwnProperty,
@@ -1631,7 +1631,7 @@
Assign.prototype.compileConditional = function(o) {
var left, right, _ref2;
_ref2 = this.variable.cacheReference(o), left = _ref2[0], right = _ref2[1];
if (left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) {
if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) {
throw new Error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been defined.");
}
if (__indexOf.call(this.context, "?") >= 0) {

View File

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

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout;

View File

@@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref,
__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.3.0
// Generated by CoffeeScript 1.3.1
(function() {
var Scope, extend, last, _ref;

View File

@@ -3,7 +3,7 @@
"description": "Unfancy JavaScript",
"keywords": ["javascript", "language", "coffeescript", "compiler"],
"author": "Jeremy Ashkenas",
"version": "1.3.0",
"version": "1.3.1",
"licenses": [{
"type": "MIT",
"url": "http://github.com/jashkenas/coffee-script/raw/master/LICENSE"

View File

@@ -21,7 +21,7 @@ else if require.registerExtension
require.registerExtension '.coffee', (content) -> compile content
# The current CoffeeScript version number.
exports.VERSION = '1.3.0'
exports.VERSION = '1.3.1'
# Words that cannot be used as identifiers in CoffeeScript code
exports.RESERVED = RESERVED

View File

@@ -1119,7 +1119,8 @@ exports.Assign = class Assign extends Base
compileConditional: (o) ->
[left, right] = @variable.cacheReference o
# Disallow conditional assignment of undefined variables.
if left.base instanceof Literal and left.base.value != "this" and not o.scope.check left.base.value
if not left.properties.length and left.base instanceof Literal and
left.base.value != "this" and not o.scope.check left.base.value
throw new Error "the variable \"#{left.base.value}\" can't be assigned with #{@context} because it has not been defined."
if "?" in @context then o.isExistentialEquals = true
new Op(@context[...-1], left, new Assign(right, @value, '=') ).compile o

View File

@@ -296,6 +296,13 @@ test "#1627: prohibit conditional assignment of undefined variables", ->
throws (-> CoffeeScript.compile "-> -> -> x ?= 10"), null, "prohibit (-> -> -> x ?= 10)"
doesNotThrow (-> CoffeeScript.compile "x = null; -> -> -> x ?= 10"), "allow (x = null; -> -> -> x ?= 10)"
test "more existential assignment", ->
global.temp ?= 0
eq global.temp, 0
global.temp or= 100
eq global.temp, 100
delete global.temp
test "#1348, #1216: existential assignment compilation", ->
nonce = {}