[CS2] 2.0.0-beta1 (#4499)
* Fix browser build to incorporate Markdown-It, not Marked * Update Google Closure Compiler; recompile browser build but with MINIFY=false, because Closure Compiler throws an error on our current code; see https://github.com/google/closure-compiler-js/issues/59 * Bump version to 2.0.0-beta1; do release build, with updated docs and annotated source
This commit is contained in:
parent
9b77371ea8
commit
db216ec384
2
Cakefile
2
Cakefile
|
@ -122,7 +122,7 @@ task 'build:browser', 'build the merged script for inclusion in the browser', ->
|
|||
return #{fs.readFileSync "./package.json"};
|
||||
})();
|
||||
"""
|
||||
for {name, src} in [{name: 'marked', src: 'lib/marked.js'}]
|
||||
for {name, src} in [{name: 'markdown-it', src: 'dist/markdown-it.min.js'}]
|
||||
code += """
|
||||
require['#{name}'] = (function() {
|
||||
var exports = {}, module = {exports: exports};
|
||||
|
|
|
@ -996,6 +996,7 @@ and optional references to the superclass.</p>
|
|||
o <span class="hljs-string">'Identifier AS Identifier'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> ExportSpecifier $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
|
||||
o <span class="hljs-string">'Identifier AS DEFAULT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> ExportSpecifier $<span class="hljs-number">1</span>, <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">3</span>
|
||||
o <span class="hljs-string">'DEFAULT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> ExportSpecifier <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'DEFAULT AS Identifier'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> ExportSpecifier <span class="hljs-keyword">new</span> Literal($<span class="hljs-number">1</span>), $<span class="hljs-number">3</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
|
|
@ -122,7 +122,7 @@ arrays, count characters, that sort of thing.</p>
|
|||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre>
|
||||
marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'marked'</span></pre></div></div>
|
||||
md = <span class="hljs-built_in">require</span>(<span class="hljs-string">'markdown-it'</span>)()</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -133,27 +133,6 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-2">¶</a>
|
||||
</div>
|
||||
<p>marked.setOptions
|
||||
renderer: new marked.Renderer()
|
||||
gfm: true
|
||||
tables: true
|
||||
breaks: false
|
||||
pedantic: false
|
||||
sanitize: true
|
||||
smartLists: true
|
||||
smartypants: false</p>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-3">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-3">¶</a>
|
||||
</div>
|
||||
<p>Peek at the beginning of a given string to see if it matches a sequence.</p>
|
||||
|
||||
</div>
|
||||
|
@ -164,11 +143,11 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-4">
|
||||
<li id="section-3">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-4">¶</a>
|
||||
<a class="pilcrow" href="#section-3">¶</a>
|
||||
</div>
|
||||
<p>Peek at the end of a given string to see if it matches a sequence.</p>
|
||||
|
||||
|
@ -181,11 +160,11 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-5">
|
||||
<li id="section-4">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-5">¶</a>
|
||||
<a class="pilcrow" href="#section-4">¶</a>
|
||||
</div>
|
||||
<p>Repeat a string <code>n</code> times.</p>
|
||||
|
||||
|
@ -196,11 +175,11 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-6">
|
||||
<li id="section-5">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-6">¶</a>
|
||||
<a class="pilcrow" href="#section-5">¶</a>
|
||||
</div>
|
||||
<p>Use clever algorithm to have O(log(n)) string concatenation operations.</p>
|
||||
|
||||
|
@ -216,11 +195,11 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-7">
|
||||
<li id="section-6">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-7">¶</a>
|
||||
<a class="pilcrow" href="#section-6">¶</a>
|
||||
</div>
|
||||
<p>Trim out all falsy values from an array.</p>
|
||||
|
||||
|
@ -232,11 +211,11 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-8">
|
||||
<li id="section-7">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-8">¶</a>
|
||||
<a class="pilcrow" href="#section-7">¶</a>
|
||||
</div>
|
||||
<p>Count the number of occurrences of a string in a string.</p>
|
||||
|
||||
|
@ -251,11 +230,11 @@ marked = <span class="hljs-built_in">require</span> <span class="hljs-string">'m
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-9">
|
||||
<li id="section-8">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
<a class="pilcrow" href="#section-8">¶</a>
|
||||
</div>
|
||||
<p>Merge objects, returning a fresh copy with attributes from both sides.
|
||||
Used every time <code>Base#compile</code> is called, to allow properties in the
|
||||
|
@ -269,11 +248,11 @@ options hash to propagate down the tree without polluting other branches.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-10">
|
||||
<li id="section-9">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-10">¶</a>
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
</div>
|
||||
<p>Extend a source object with the properties of another object (shallow copy).</p>
|
||||
|
||||
|
@ -287,11 +266,11 @@ options hash to propagate down the tree without polluting other branches.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-11">
|
||||
<li id="section-10">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
<a class="pilcrow" href="#section-10">¶</a>
|
||||
</div>
|
||||
<p>Return a flattened version of an array.
|
||||
Handy for getting a list of <code>children</code> from the nodes.</p>
|
||||
|
@ -310,11 +289,11 @@ Handy for getting a list of <code>children</code> from the nodes.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-12">
|
||||
<li id="section-11">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
</div>
|
||||
<p>Delete a key from an object, returning the value. Useful when a node is
|
||||
looking for a particular method in an options hash.</p>
|
||||
|
@ -329,11 +308,11 @@ looking for a particular method in an options hash.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-13">
|
||||
<li id="section-12">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
</div>
|
||||
<p>Typical Array::some</p>
|
||||
|
||||
|
@ -346,19 +325,43 @@ looking for a particular method in an options hash.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-13">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
</div>
|
||||
<p>Simple function for extracting code from Literate CoffeeScript by stripping
|
||||
out all non-code blocks, producing a string of CoffeeScript code that can
|
||||
be compiled “normally.” Uses <a href="https://markdown-it.github.io/">MarkdownIt</a>
|
||||
to tell the difference between Markdown and code blocks.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre>exports.invertLiterate = <span class="hljs-function"><span class="hljs-params">(code)</span> -></span>
|
||||
out = []
|
||||
md.renderer.rules =</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-14">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-14">¶</a>
|
||||
</div>
|
||||
<p>Simple function for extracting code from Literate CoffeeScript by stripping
|
||||
out all non-code blocks, producing a string of CoffeeScript code that can
|
||||
be compiled “normally.”</p>
|
||||
<p>Delete all other rules, since all we want are the code blocks.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre>exports.invertLiterate = <span class="hljs-function"><span class="hljs-params">(code)</span> -></span></pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> code_block: <span class="hljs-function"><span class="hljs-params">(tokens, idx, options, env, slf)</span> -></span>
|
||||
startLine = tokens[idx].map[<span class="hljs-number">0</span>]
|
||||
lines = tokens[idx].content.split <span class="hljs-string">'\n'</span>
|
||||
<span class="hljs-keyword">for</span> line, i <span class="hljs-keyword">in</span> lines
|
||||
out[startLine + i] = line
|
||||
md.render code
|
||||
out.join <span class="hljs-string">'\n'</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -369,60 +372,6 @@ be compiled “normally.”</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-15">¶</a>
|
||||
</div>
|
||||
<p>Create a placeholder for tabs, that isn’t used anywhere in <code>code</code>, and then
|
||||
re-insert the tabs after code extraction.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">generateRandomToken</span> = -></span>
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{Math.random() * Date.now()}</span>"</span>
|
||||
<span class="hljs-keyword">while</span> token <span class="hljs-keyword">is</span> <span class="hljs-literal">undefined</span> <span class="hljs-keyword">or</span> code.indexOf(token) <span class="hljs-keyword">isnt</span> <span class="hljs-number">-1</span>
|
||||
token = generateRandomToken()
|
||||
|
||||
code = code.replace <span class="hljs-string">"\t"</span>, token</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-16">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
</div>
|
||||
<p>Parse as markdown, discard everything except code blocks.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> out = <span class="hljs-string">""</span>
|
||||
<span class="hljs-keyword">for</span> item <span class="hljs-keyword">in</span> marked.lexer code, {}
|
||||
out += <span class="hljs-string">"<span class="hljs-subst">#{item.text}</span>\n"</span> <span class="hljs-keyword">if</span> item.type <span class="hljs-keyword">is</span> <span class="hljs-string">'code'</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-17">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
</div>
|
||||
<p>Put the tabs back in.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> out.replace token, <span class="hljs-string">"\t"</span>
|
||||
out</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-18">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
</div>
|
||||
<p>Merge two jison-style location data objects together.
|
||||
If <code>last</code> is not provided, this will simply return <code>first</code>.</p>
|
||||
|
||||
|
@ -440,11 +389,11 @@ If <code>last</code> is not provided, this will simply return <code>first</code>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-19">
|
||||
<li id="section-16">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-19">¶</a>
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
</div>
|
||||
<p>This returns a function which takes an object as a parameter, and if that
|
||||
object is an AST node, updates that object’s locationData.
|
||||
|
@ -462,11 +411,11 @@ The object is returned either way.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-20">
|
||||
<li id="section-17">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-20">¶</a>
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
</div>
|
||||
<p>Convert jison location data to a string.
|
||||
<code>obj</code> can be a token, or a locationData.</p>
|
||||
|
@ -486,11 +435,11 @@ The object is returned either way.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-21">
|
||||
<li id="section-18">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-21">¶</a>
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
</div>
|
||||
<p>A <code>.coffee.md</code> compatible version of <code>basename</code>, that returns the file sans-extension.</p>
|
||||
|
||||
|
@ -509,11 +458,11 @@ The object is returned either way.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-22">
|
||||
<li id="section-19">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-22">¶</a>
|
||||
<a class="pilcrow" href="#section-19">¶</a>
|
||||
</div>
|
||||
<p>Determine if a filename represents a CoffeeScript file.</p>
|
||||
|
||||
|
@ -524,11 +473,11 @@ The object is returned either way.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-23">
|
||||
<li id="section-20">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-23">¶</a>
|
||||
<a class="pilcrow" href="#section-20">¶</a>
|
||||
</div>
|
||||
<p>Determine if a filename represents a Literate CoffeeScript file.</p>
|
||||
|
||||
|
@ -539,11 +488,11 @@ The object is returned either way.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-24">
|
||||
<li id="section-21">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
<a class="pilcrow" href="#section-21">¶</a>
|
||||
</div>
|
||||
<p>Throws a SyntaxError from a given location.
|
||||
The error’s <code>toString</code> will return an error message following the “standard”
|
||||
|
@ -560,11 +509,11 @@ marker showing where the error is.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-25">
|
||||
<li id="section-22">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
<a class="pilcrow" href="#section-22">¶</a>
|
||||
</div>
|
||||
<p>Instead of showing the compiler’s stacktrace, show our custom error message
|
||||
(this is useful when the error bubbles up in Node.js applications that
|
||||
|
@ -579,11 +528,11 @@ compile CoffeeScript for example).</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-26">
|
||||
<li id="section-23">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
<a class="pilcrow" href="#section-23">¶</a>
|
||||
</div>
|
||||
<p>Update a compiler SyntaxError with source code information if it didn’t have
|
||||
it already.</p>
|
||||
|
@ -595,11 +544,11 @@ it already.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-27">
|
||||
<li id="section-24">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-27">¶</a>
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
</div>
|
||||
<p>Avoid screwing up the <code>stack</code> property of other errors (i.e. possible bugs).</p>
|
||||
|
||||
|
@ -625,11 +574,11 @@ it already.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-28">
|
||||
<li id="section-25">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-28">¶</a>
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
</div>
|
||||
<p>Show only the first line on multi-line errors.</p>
|
||||
|
||||
|
@ -641,11 +590,11 @@ it already.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-29">
|
||||
<li id="section-26">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-29">¶</a>
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
</div>
|
||||
<p>Check to see if we’re running on a color-enabled TTY.</p>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -714,7 +714,7 @@ textarea {
|
|||
<section id="overview">
|
||||
<p><strong>CoffeeScript is a little language that compiles into JavaScript.</strong> Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.</p>
|
||||
<p>The golden rule of CoffeeScript is: <em>“It’s just JavaScript.”</em> The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable, pretty-printed, and tends to run as fast or faster than the equivalent handwritten JavaScript.</p>
|
||||
<p><strong>Latest Version:</strong> <a href="http://github.com/jashkenas/coffeescript/tarball/2.0.0-alpha1">2.0.0-alpha1</a></p>
|
||||
<p><strong>Latest Version:</strong> <a href="http://github.com/jashkenas/coffeescript/tarball/2.0.0-beta1">2.0.0-beta1</a></p>
|
||||
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install -g coffeescript@next
|
||||
</code></pre>
|
||||
</blockquote>
|
||||
|
@ -3126,7 +3126,7 @@ The CoffeeScript logo is available in SVG for use in presentations.</li>
|
|||
</section>
|
||||
<section id="annotated-source">
|
||||
<h2>Annotated Source</h2>
|
||||
<p>You can browse the CoffeeScript 2.0.0-alpha1 source in readable, annotated form <a href="http://coffeescript.org/v2/annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
|
||||
<p>You can browse the CoffeeScript 2.0.0-beta1 source in readable, annotated form <a href="http://coffeescript.org/v2/annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
|
||||
<ul>
|
||||
<li><a href="http://coffeescript.org/v2/annotated-source/grammar.html">Grammar Rules — src/grammar</a></li>
|
||||
<li><a href="http://coffeescript.org/v2/annotated-source/lexer.html">Lexing Tokens — src/lexer</a></li>
|
||||
|
@ -3411,6 +3411,14 @@ B = class B extends A {
|
|||
<li>Calling a function named <code>get</code> or <code>set</code> now requires parentheses, to disambiguate from the <code>get</code> or <code>set</code> keywords (which are <a href="#unsupported-get-set">disallowed</a>).</li>
|
||||
<li>The compiler now requires Node 7.6+, the first version of Node to support asynchronous functions without requiring a flag.</li>
|
||||
</ul>
|
||||
<div class="anchor" id="1.12.5"></div>
|
||||
<h2 class="header">
|
||||
<a href="https://github.com/jashkenas/coffeescript/compare/1.12.4...1.12.5">1.12.5</a>
|
||||
<span class="timestamp"> — <time datetime="2017-04-10">April 10, 2017</time></span>
|
||||
</h2><ul>
|
||||
<li>Better handling of <code>default</code>, <code>from</code>, <code>as</code> and <code>*</code> within <code>import</code> and <code>export</code> statements. You can now import or export a member named <code>default</code> and the compiler won’t interpret it as the <code>default</code> keyword.</li>
|
||||
<li>Fixed a bug where invalid octal escape sequences weren’t throwing errors in the compiler.</li>
|
||||
</ul>
|
||||
<div class="anchor" id="2.0.0-alpha1"></div>
|
||||
<h2 class="header">
|
||||
<a href="https://github.com/jashkenas/coffeescript/compare/1.12.4...2.0.0-alpha1">2.0.0-alpha1</a>
|
||||
|
|
|
@ -440,7 +440,8 @@ test "#1192: assignment starting with object literals", ->
|
|||
# Destructuring Assignment
|
||||
|
||||
test "empty destructuring assignment", ->
|
||||
{} = [] = undefined
|
||||
{} = {}
|
||||
[] = []
|
||||
|
||||
test "chained destructuring assignments", ->
|
||||
[a] = {0: b} = {'0': c} = [nonce={}]
|
||||
|
@ -603,7 +604,7 @@ test "simple array destructuring defaults", ->
|
|||
[a = 2] = [undefined]
|
||||
eq 2, a
|
||||
[a = 3] = [null]
|
||||
eq 3, a
|
||||
eq null, a # Breaking change in CS2: per ES2015, default values are applied for `undefined` but not for `null`.
|
||||
[a = 4] = [0]
|
||||
eq 0, a
|
||||
arr = [a = 5]
|
||||
|
@ -616,7 +617,7 @@ test "simple object destructuring defaults", ->
|
|||
{b = 2} = {b: undefined}
|
||||
eq b, 2
|
||||
{b = 3} = {b: null}
|
||||
eq b, 3
|
||||
eq b, null # Breaking change in CS2: per ES2015, default values are applied for `undefined` but not for `null`.
|
||||
{b = 4} = {b: 0}
|
||||
eq b, 0
|
||||
|
||||
|
@ -625,17 +626,17 @@ test "simple object destructuring defaults", ->
|
|||
{b: c = 2} = {b: undefined}
|
||||
eq c, 2
|
||||
{b: c = 3} = {b: null}
|
||||
eq c, 3
|
||||
eq c, null # Breaking change in CS2: per ES2015, default values are applied for `undefined` but not for `null`.
|
||||
{b: c = 4} = {b: 0}
|
||||
eq c, 0
|
||||
|
||||
test "multiple array destructuring defaults", ->
|
||||
[a = 1, b = 2, c] = [null, 12, 13]
|
||||
[a = 1, b = 2, c] = [undefined, 12, 13]
|
||||
eq a, 1
|
||||
eq b, 12
|
||||
eq c, 13
|
||||
[a, b = 2, c = 3] = [null, 12, 13]
|
||||
eq a, null
|
||||
[a, b = 2, c = 3] = [undefined, 12, 13]
|
||||
eq a, undefined
|
||||
eq b, 12
|
||||
eq c, 13
|
||||
[a = 1, b, c = 3] = [11, 12]
|
||||
|
@ -666,7 +667,7 @@ test "destructuring assignment with context (@) properties and defaults", ->
|
|||
a={}; b={}; c={}; d={}; e={}
|
||||
obj =
|
||||
fn: () ->
|
||||
local = [a, {b, c: null}, d]
|
||||
local = [a, {b, c: undefined}, d]
|
||||
[@a, {b: @b = b, @c = c}, @d, @e = e] = local
|
||||
eq undefined, obj[key] for key in ['a','b','c','d','e']
|
||||
obj.fn()
|
||||
|
@ -685,7 +686,7 @@ test "destructuring assignment with defaults single evaluation", ->
|
|||
[a = fn()] = [10]
|
||||
eq 10, a
|
||||
eq 1, callCount
|
||||
{a = fn(), b: c = fn()} = {a: 20, b: null}
|
||||
{a = fn(), b: c = fn()} = {a: 20, b: undefined}
|
||||
eq 20, a
|
||||
eq c, 1
|
||||
eq callCount, 2
|
||||
|
@ -4874,6 +4875,13 @@ test "octal escapes", ->
|
|||
/a\\0\\tb\\\\\\07c/
|
||||
\ \ \ \ ^\^^
|
||||
'''
|
||||
assertErrorFormat '''
|
||||
/a\\1\\tb\\\\\\07c/
|
||||
''', '''
|
||||
[stdin]:1:10: error: octal escape sequences are not allowed \\07
|
||||
/a\\1\\tb\\\\\\07c/
|
||||
\ \ \ \ ^\^^
|
||||
'''
|
||||
assertErrorFormat '''
|
||||
///a
|
||||
#{b} \\01///
|
||||
|
@ -5771,6 +5779,142 @@ test "new with 'super'", ->
|
|||
^^^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in object", ->
|
||||
assertErrorFormat '''
|
||||
obj =
|
||||
get foo: ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
get foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in object", ->
|
||||
assertErrorFormat '''
|
||||
obj =
|
||||
set foo: ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
set foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in inline implicit object", ->
|
||||
assertErrorFormat 'obj = get foo: ->', '''
|
||||
[stdin]:1:7: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
obj = get foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in inline implicit object", ->
|
||||
assertErrorFormat 'obj = set foo: ->', '''
|
||||
[stdin]:1:7: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
obj = set foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in inline explicit object", ->
|
||||
assertErrorFormat 'obj = {get foo: ->}', '''
|
||||
[stdin]:1:8: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
obj = {get foo: ->}
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in inline explicit object", ->
|
||||
assertErrorFormat 'obj = {set foo: ->}', '''
|
||||
[stdin]:1:8: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
obj = {set foo: ->}
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in function", ->
|
||||
assertErrorFormat '''
|
||||
f = ->
|
||||
get foo: ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
get foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in function", ->
|
||||
assertErrorFormat '''
|
||||
f = ->
|
||||
set foo: ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
set foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in inline function", ->
|
||||
assertErrorFormat 'f = -> get foo: ->', '''
|
||||
[stdin]:1:8: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
f = -> get foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in inline function", ->
|
||||
assertErrorFormat 'f = -> set foo: ->', '''
|
||||
[stdin]:1:8: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
f = -> set foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in class", ->
|
||||
assertErrorFormat '''
|
||||
class A
|
||||
get foo: ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
get foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in class", ->
|
||||
assertErrorFormat '''
|
||||
class A
|
||||
set foo: ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
set foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword in inline class", ->
|
||||
assertErrorFormat 'class A then get foo: ->', '''
|
||||
[stdin]:1:14: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
class A then get foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword in inline class", ->
|
||||
assertErrorFormat 'class A then set foo: ->', '''
|
||||
[stdin]:1:14: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
class A then set foo: ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "getter keyword before static method", ->
|
||||
assertErrorFormat '''
|
||||
class A
|
||||
get @foo = ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'get' cannot be used as a keyword, or as a function call without parentheses
|
||||
get @foo = ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
test "setter keyword before static method", ->
|
||||
assertErrorFormat '''
|
||||
class A
|
||||
set @foo = ->
|
||||
''', '''
|
||||
[stdin]:2:3: error: 'set' cannot be used as a keyword, or as a function call without parentheses
|
||||
set @foo = ->
|
||||
^^^
|
||||
'''
|
||||
|
||||
</script>
|
||||
<script type="text/x-coffeescript" class="test" id="eval">
|
||||
if vm = require? 'vm'
|
||||
|
@ -6241,6 +6385,23 @@ test "tabs and spaces cannot be mixed for indentation", ->
|
|||
catch e
|
||||
eq 'mixed indentation', e.message
|
||||
|
||||
test "#4487: Handle unusual outdentation", ->
|
||||
a =
|
||||
switch 1
|
||||
when 2
|
||||
no
|
||||
when 3 then no
|
||||
when 1 then yes
|
||||
eq yes, a
|
||||
|
||||
b = do ->
|
||||
if no
|
||||
if no
|
||||
1
|
||||
2
|
||||
3
|
||||
eq b, undefined
|
||||
|
||||
</script>
|
||||
<script type="text/x-coffeescript" class="test" id="function_invocation">
|
||||
# Function Invocation
|
||||
|
@ -6920,7 +7081,7 @@ test "Non-callable literals shouldn't compile", ->
|
|||
cantCompile '[1..10][2..9] 2'
|
||||
cantCompile '[1..10][2..9](2)'
|
||||
|
||||
test 'implicit invocation with implicit object literal', ->
|
||||
test "implicit invocation with implicit object literal", ->
|
||||
f = (obj) -> eq 1, obj.a
|
||||
|
||||
f
|
||||
|
@ -6952,6 +7113,48 @@ test 'implicit invocation with implicit object literal', ->
|
|||
"#{a}": 1
|
||||
eq 2, obj.a
|
||||
|
||||
test "get and set can be used as function names when not ambiguous with `get`/`set` keywords", ->
|
||||
get = (val) -> val
|
||||
set = (val) -> val
|
||||
eq 2, get(2)
|
||||
eq 3, set(3)
|
||||
eq 'a', get('a')
|
||||
eq 'b', set('b')
|
||||
|
||||
get = ({val}) -> val
|
||||
set = ({val}) -> val
|
||||
eq 4, get({val: 4})
|
||||
eq 5, set({val: 5})
|
||||
eq 'c', get({val: 'c'})
|
||||
eq 'd', set({val: 'd'})
|
||||
|
||||
test "get and set can be used as variable and property names", ->
|
||||
get = 2
|
||||
set = 3
|
||||
eq 2, get
|
||||
eq 3, set
|
||||
|
||||
{get} = {get: 4}
|
||||
{set} = {set: 5}
|
||||
eq 4, get
|
||||
eq 5, set
|
||||
|
||||
test "get and set can be used as class method names", ->
|
||||
class A
|
||||
get: -> 2
|
||||
set: -> 3
|
||||
|
||||
a = new A()
|
||||
eq 2, a.get()
|
||||
eq 3, a.set()
|
||||
|
||||
class B
|
||||
@get = -> 4
|
||||
@set = -> 5
|
||||
|
||||
eq 4, B.get()
|
||||
eq 5, B.set()
|
||||
|
||||
</script>
|
||||
<script type="text/x-coffeescript" class="test" id="functions">
|
||||
# Function Literals
|
||||
|
@ -7135,7 +7338,7 @@ test "destructuring in function definition", ->
|
|||
{url, async, beforeSend, cache, method, data}
|
||||
|
||||
fn = ->
|
||||
deepEqual ajax('/home', beforeSend: fn, cache: null, method: 'post'), {
|
||||
deepEqual ajax('/home', beforeSend: fn, method: 'post'), {
|
||||
url: '/home', async: true, beforeSend: fn, cache: true, method: 'post', data: {}
|
||||
}
|
||||
|
||||
|
@ -7309,6 +7512,16 @@ test "#4406 Destructured parameter default evaluation order with generator funct
|
|||
foo = ({ a = next() }, b = next()) -> [ a, b ]
|
||||
arrayEq foo({}), [1, 2]
|
||||
|
||||
test "Destructured parameter with default value, that itself has a default value", ->
|
||||
# Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
|
||||
draw = ({size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}) -> "#{size}-#{coords.x}-#{coords.y}-#{radius}"
|
||||
output = draw
|
||||
coords:
|
||||
x: 18
|
||||
y: 30
|
||||
radius: 30
|
||||
eq output, 'big-18-30-30'
|
||||
|
||||
</script>
|
||||
<script type="text/x-coffeescript" class="test" id="generators">
|
||||
# Generators
|
||||
|
@ -8055,8 +8268,7 @@ test "escaped JavaScript blocks speed round", ->
|
|||
|
||||
</script>
|
||||
<script type="text/x-literate-coffeescript" class="test" id="literate">
|
||||
Literate CoffeeScript Test
|
||||
--------------------------
|
||||
# Literate CoffeeScript Test
|
||||
|
||||
comment comment
|
||||
|
||||
|
@ -8120,11 +8332,12 @@ Tabs work too:
|
|||
|
||||
<p>
|
||||
|
||||
if true
|
||||
executed = true # should not execute, this is just HTML para, not code!
|
||||
|
||||
</p>
|
||||
|
||||
test "should ignore indented sections inside HTML", ->
|
||||
test "should ignore code blocks inside HTML", ->
|
||||
eq executed, false
|
||||
|
||||
---
|
||||
|
@ -8176,24 +8389,8 @@ Tabs work too:
|
|||
|
||||
---
|
||||
|
||||
This next one probably passes because a string is inoffensive in compiled js, also, can't get `marked` to parse it correctly, and not sure if empty line is permitted between title and reference
|
||||
|
||||
This is [an example][id] reference-style link.
|
||||
[id]: http://example.com/
|
||||
|
||||
"Optional Title Here"
|
||||
|
||||
---
|
||||
|
||||
executed = no
|
||||
|
||||
1986. What a great season.
|
||||
executed = yes
|
||||
|
||||
and test...
|
||||
|
||||
test "should recognise indented code blocks in lists", ->
|
||||
ok executed
|
||||
[id]: http://example.com/ "Optional Title Here"
|
||||
|
||||
---
|
||||
|
||||
|
@ -8205,7 +8402,7 @@ and test...
|
|||
|
||||
and test...
|
||||
|
||||
test "should recognise indented code blocks in lists with empty line as separator", ->
|
||||
test "should recognize indented code blocks in lists with empty line as separator", ->
|
||||
ok executed
|
||||
|
||||
---
|
||||
|
@ -8220,6 +8417,174 @@ and test...
|
|||
test "should ignore indented code in escaped list like number", ->
|
||||
eq executed, no
|
||||
|
||||
one last test!
|
||||
|
||||
test "block quotes should render correctly", ->
|
||||
quote = '''
|
||||
foo
|
||||
and bar!
|
||||
'''
|
||||
eq quote, 'foo\n and bar!'
|
||||
|
||||
</script>
|
||||
<script type="text/x-literate-coffeescript" class="test" id="literate_tabbed">
|
||||
# Tabbed Literate CoffeeScript Test
|
||||
|
||||
comment comment
|
||||
|
||||
test "basic literate CoffeeScript parsing", ->
|
||||
ok yes
|
||||
|
||||
now with a...
|
||||
|
||||
test "broken up indentation", ->
|
||||
|
||||
... broken up ...
|
||||
|
||||
do ->
|
||||
|
||||
... nested block.
|
||||
|
||||
ok yes
|
||||
|
||||
Code must be separated from text by a blank line.
|
||||
|
||||
test "code blocks must be preceded by a blank line", ->
|
||||
|
||||
The next line is part of the text and will not be executed.
|
||||
fail()
|
||||
|
||||
ok yes
|
||||
|
||||
Code in `backticks is not parsed` and...
|
||||
|
||||
test "comments in indented blocks work", ->
|
||||
do ->
|
||||
do ->
|
||||
# Regular comment.
|
||||
|
||||
###
|
||||
Block comment.
|
||||
###
|
||||
|
||||
ok yes
|
||||
|
||||
Regular [Markdown](http://example.com/markdown) features, like links
|
||||
and unordered lists, are fine:
|
||||
|
||||
* I
|
||||
|
||||
* Am
|
||||
|
||||
* A
|
||||
|
||||
* List
|
||||
|
||||
Spaces work too:
|
||||
|
||||
test "spaced code", ->
|
||||
ok yes
|
||||
|
||||
---
|
||||
|
||||
# keep track of whether code blocks are executed or not
|
||||
executed = false
|
||||
|
||||
<p>
|
||||
|
||||
if true
|
||||
executed = true # should not execute, this is just HTML para, not code!
|
||||
|
||||
</p>
|
||||
|
||||
test "should ignore code blocks inside HTML", ->
|
||||
eq executed, false
|
||||
|
||||
---
|
||||
|
||||
* A list item with a code block:
|
||||
|
||||
test "basic literate CoffeeScript parsing", ->
|
||||
ok yes
|
||||
|
||||
---
|
||||
|
||||
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
|
||||
viverra nec, fringilla in, laoreet vitae, risus.
|
||||
|
||||
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
|
||||
Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
---
|
||||
|
||||
1. This is a list item with two paragraphs. Lorem ipsum dolor
|
||||
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
|
||||
mi posuere lectus.
|
||||
|
||||
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
|
||||
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
|
||||
sit amet velit.
|
||||
|
||||
2. Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
---
|
||||
|
||||
1. This is a list item with two paragraphs. Lorem ipsum dolor
|
||||
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
|
||||
mi posuere lectus.
|
||||
|
||||
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
|
||||
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
|
||||
sit amet velit.
|
||||
|
||||
2. Suspendisse id sem consectetuer libero luctus adipiscing.
|
||||
|
||||
---
|
||||
|
||||
* A list item with a blockquote:
|
||||
|
||||
> This is a blockquote
|
||||
> inside a list item.
|
||||
|
||||
---
|
||||
|
||||
This is [an example][id] reference-style link.
|
||||
[id]: http://example.com/ "Optional Title Here"
|
||||
|
||||
---
|
||||
|
||||
executed = no
|
||||
|
||||
1986. What a great season.
|
||||
|
||||
executed = yes
|
||||
|
||||
and test...
|
||||
|
||||
test "should recognize indented code blocks in lists with empty line as separator", ->
|
||||
ok executed
|
||||
|
||||
---
|
||||
|
||||
executed = no
|
||||
|
||||
1986\. What a great season.
|
||||
executed = yes
|
||||
|
||||
and test...
|
||||
|
||||
test "should ignore indented code in escaped list like number", ->
|
||||
eq executed, no
|
||||
|
||||
one last test!
|
||||
|
||||
test "block quotes should render correctly", ->
|
||||
quote = '''
|
||||
foo
|
||||
and bar!
|
||||
'''
|
||||
eq quote, 'foo\n\t\tand bar!'
|
||||
|
||||
</script>
|
||||
<script type="text/x-coffeescript" class="test" id="location">
|
||||
|
@ -9561,7 +9926,7 @@ test "export an aliased member named default", ->
|
|||
};"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "export an imported member named default", ->
|
||||
test "import an imported member named default", ->
|
||||
input = "import { default } from 'lib'"
|
||||
output = """
|
||||
import {
|
||||
|
@ -9569,7 +9934,7 @@ test "export an imported member named default", ->
|
|||
} from 'lib';"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "export an imported aliased member named default", ->
|
||||
test "import an imported aliased member named default", ->
|
||||
input = "import { default as def } from 'lib'"
|
||||
output = """
|
||||
import {
|
||||
|
@ -9577,6 +9942,22 @@ test "export an imported aliased member named default", ->
|
|||
} from 'lib';"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "export an imported member named default", ->
|
||||
input = "export { default } from 'lib'"
|
||||
output = """
|
||||
export {
|
||||
default
|
||||
} from 'lib';"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "export an imported aliased member named default", ->
|
||||
input = "export { default as def } from 'lib'"
|
||||
output = """
|
||||
export {
|
||||
default as def
|
||||
} from 'lib';"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "#4394: export shouldn't prevent variable declarations", ->
|
||||
input = """
|
||||
x = 1
|
||||
|
@ -9593,6 +9974,121 @@ test "#4394: export shouldn't prevent variable declarations", ->
|
|||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "#4451: `default` in an export statement is only treated as a keyword when it follows `export` or `as`", ->
|
||||
input = "export default { default: 1 }"
|
||||
output = """
|
||||
export default {
|
||||
"default": 1
|
||||
};
|
||||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
test "#4491: import- and export-specific lexing should stop after import/export statement", ->
|
||||
input = """
|
||||
import {
|
||||
foo,
|
||||
bar as baz
|
||||
} from 'lib'
|
||||
|
||||
foo as
|
||||
3 * as 4
|
||||
from 'foo'
|
||||
"""
|
||||
output = """
|
||||
import {
|
||||
foo,
|
||||
bar as baz
|
||||
} from 'lib';
|
||||
|
||||
foo(as);
|
||||
|
||||
3 * as(4);
|
||||
|
||||
from('foo');
|
||||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
input = """
|
||||
import { foo, bar as baz } from 'lib'
|
||||
|
||||
foo as
|
||||
3 * as 4
|
||||
from 'foo'
|
||||
"""
|
||||
output = """
|
||||
import {
|
||||
foo,
|
||||
bar as baz
|
||||
} from 'lib';
|
||||
|
||||
foo(as);
|
||||
|
||||
3 * as(4);
|
||||
|
||||
from('foo');
|
||||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
input = """
|
||||
import * as lib from 'lib'
|
||||
|
||||
foo as
|
||||
3 * as 4
|
||||
from 'foo'
|
||||
"""
|
||||
output = """
|
||||
import * as lib from 'lib';
|
||||
|
||||
foo(as);
|
||||
|
||||
3 * as(4);
|
||||
|
||||
from('foo');
|
||||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
input = """
|
||||
export {
|
||||
foo,
|
||||
bar
|
||||
}
|
||||
|
||||
foo as
|
||||
3 * as 4
|
||||
from 'foo'
|
||||
"""
|
||||
output = """
|
||||
export {
|
||||
foo,
|
||||
bar
|
||||
};
|
||||
|
||||
foo(as);
|
||||
|
||||
3 * as(4);
|
||||
|
||||
from('foo');
|
||||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
input = """
|
||||
export * from 'lib'
|
||||
|
||||
foo as
|
||||
3 * as 4
|
||||
from 'foo'
|
||||
"""
|
||||
output = """
|
||||
export * from 'lib';
|
||||
|
||||
foo(as);
|
||||
|
||||
3 * as(4);
|
||||
|
||||
from('foo');
|
||||
"""
|
||||
eq toJS(input), output
|
||||
|
||||
</script>
|
||||
<script type="text/x-coffeescript" class="test" id="numbers">
|
||||
# Number Literals
|
||||
|
@ -11861,7 +12357,7 @@ test "SourceMap tests", ->
|
|||
# Strict Early Errors
|
||||
# -------------------
|
||||
|
||||
# The following are prohibited under ES5's `strict` mode
|
||||
# The following are prohibited under ES5’s `strict` mode
|
||||
# * `Octal Integer Literals`
|
||||
# * `Octal Escape Sequences`
|
||||
# * duplicate property definitions in `Object Literal`s
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(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; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, packageJson, parser, path, ref, sourceMaps, sources, vm, withPrettyErrors,
|
||||
hasProp = {}.hasOwnProperty;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(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, 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; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var buildLocationData, extend, flatten, md, ref, repeat, syntaxErrorToString;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var key, ref, val;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(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, HERE_JSTOKEN, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVERSES, JSTOKEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, REGEX_INVALID_ESCAPE, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_INVALID_ESCAPE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, isForFrom, isUnassignable, key, locationDataToString, 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; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var Access, Arr, Assign, AwaitReturn, Base, Block, BooleanLiteral, Call, Class, Code, CodeFragment, Comment, ExecutableClassBody, Existence, Expansion, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, ExportSpecifierList, Extends, For, HoistTarget, 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, Super, SuperCall, Switch, TAB, THIS, TaggedTemplateCall, ThisLiteral, Throw, Try, UTILITIES, UndefinedLiteral, Value, While, YES, YieldReturn, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, isLiteralArguments, isLiteralThis, isUnassignable, locationDataToString, merge, multident, shouldCacheOrIsAssignable, some, starts, throwSyntaxError, unfoldSoak, utility,
|
||||
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; },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, runInContext, updateSyntaxError, vm;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(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, 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; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(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; };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
// Generated by CoffeeScript 2.0.0-beta1
|
||||
(function() {
|
||||
var LineMap, SourceMap;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"compiler"
|
||||
],
|
||||
"author": "Jeremy Ashkenas",
|
||||
"version": "2.0.0-alpha1",
|
||||
"version": "2.0.0-beta1",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=7.6.0"
|
||||
|
@ -40,7 +40,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"docco": "~0.7.0",
|
||||
"google-closure-compiler-js": "^20170218.0.0",
|
||||
"google-closure-compiler-js": "^20170409.0.0",
|
||||
"highlight.js": "~9.10.0",
|
||||
"jison": ">=0.4.17",
|
||||
"underscore": "~1.8.3"
|
||||
|
|
Loading…
Reference in New Issue