Comparing changes
Open a pull request
|
|
jashkenas |
Adding the coffee-script-source gem publisher to the Rakefile.
|
57bd6bc
|
|||
|
|
jashkenas |
Updating rake task to pull version number and date.
|
9db6d6f
|
|
|
michaelficarra |
adding tests for #855
|
c0cb0c3
|
|||
|
|
michaelficarra |
fixes #855; fix partially inspired by satyr/coco 3e37cf32
|
63cbb64
|
|
|
jashkenas |
Coco 38aa762: rewriter: made addImplicitBraces consume multiple leadi…
…ng comments |
1f5727f
|
|
|
jashkenas |
Adding precedence change note to changelog
|
69664a1
|
|
|
michaelficarra |
added test for #891: incorrect inversion of chained comparisons; fixed a
faulty test case in test/test_switch.coffee |
56e10f9
|
|||
|
|
michaelficarra |
fix for #891: incorrect inversion of chained comparisons
|
992324b
|
|
|
michaelficarra |
Reverted previous change to what was believed to be an errant test case.
Also added a test for NaN safety |
b1ba298
|
|||
|
|
michaelficarra |
Issue #891: cannot safely invert `<` and `>` to `>=` and `<=` (or the
other way around). Proper fix this time. |
dd18703
|
|||
|
|
michaelficarra |
Finally got `!==` and `===` back to inverting again (instead of wrapp…
…ing in `!()`) Also, removed the `@inverted` kludge. It was gross to begin with, but I didn't know the proper way to do it. |
23b4d2f
|
|||
|
|
michaelficarra |
Chained comparisons now properly apply DeMorgan's Laws. I couldn't
believe there wasn't a test to remind me to toggle the
{dis,con}junctions. Added that test. |
c50cb65
|
|||
|
|
jashkenas |
style tweaks to previous patch.
|
67c20c0
|
|
|
jashkenas |
redocumenting slices/splices ... issue #833
|
75ca0f2
|
|||
|
|
jashkenas |
typo
|
85521f8
|
|||
|
|
jashkenas |
simplifying generated output for common-case splices.
|
c7a9801
|
|
|
jashkenas |
Fixing direct construction splats.
|
c0bbc60
|
|||
|
|
jashkenas |
Issue #897 ... fixed leaking direct-call-plucked comprehension variab…
…les, due to shared scope. |
2decb30
|
|||
|
|
jashkenas |
Issue #901 ... allow constructor functions to maintain their position…
… in the class body. |
ec64646
|
|
|
jashkenas |
rebuilding browser coffee-script.js ... all tests pass.
|
3eac6ae
|
|||
|
|
jashkenas |
refactoring Scope.
|
2fb269a
|
|||
|
|
jashkenas |
no-op.
|
edd0c5a
|
|||
|
|
jashkenas |
CoffeeScript 0.9.6
|
fa53a4c
|
- +5 −1 Cakefile
- +57 −0 Rakefile
- +1 −6 documentation/coffee/array_comprehensions.coffee
- +1 −1 documentation/coffee/block_comment.coffee
- +6 −0 documentation/coffee/slices.coffee
- +5 −0 documentation/coffee/splices.coffee
- +5 −0 documentation/css/docs.css
- +1 −1 documentation/docs/cake.html
- +1 −1 documentation/docs/coffee-script.html
- +16 −12 documentation/docs/command.html
- +3 −4 documentation/docs/grammar.html
- +1 −1 documentation/docs/helpers.html
- +3 −3 documentation/docs/lexer.html
- +79 −82 documentation/docs/nodes.html
- +4 −3 documentation/docs/repl.html
- +8 −15 documentation/docs/rewriter.html
- +22 −36 documentation/docs/scope.html
- +150 −38 documentation/index.html.erb
- +2 −13 documentation/js/array_comprehensions.js
- +1 −1 documentation/js/block_comment.js
- +1 −1 documentation/js/comparisons.js
- +0 −2 documentation/js/expressions_comprehension.js
- +0 −2 documentation/js/object_comprehensions.js
- +4 −0 documentation/js/slices.js
- +1 −1 documentation/js/splats.js
- +3 −0 documentation/js/splices.js
- +1 −1 documentation/js/while.js
- +5 −6 examples/underscore.coffee
- +2 −2 extras/coffee-script.js
- +184 −73 index.html
- +1 −1 lib/coffee-script.js
- +20 −14 lib/command.js
- +4 −4 lib/grammar.js
- +0 −2 lib/index.js
- +7 −7 lib/lexer.js
- +137 −143 lib/nodes.js
- +1 −1 lib/optparse.js
- +147 −149 lib/parser.js
- +6 −2 lib/repl.js
- +12 −12 lib/rewriter.js
- +17 −60 lib/scope.js
- +1 −1 package.json
- +1 −1 src/cake.coffee
- +1 −1 src/coffee-script.coffee
- +15 −11 src/command.coffee
- +3 −4 src/grammar.coffee
- +1 −1 src/helpers.coffee
- +3 −3 src/lexer.coffee
- +82 −85 src/nodes.coffee
- +8 −1 src/repl.coffee
- +8 −15 src/rewriter.coffee
- +14 −49 src/scope.coffee
- +41 −0 test/test_classes.coffee
- +2 −1 test/test_compilation.coffee
- +24 −2 test/test_comprehensions.coffee
- +22 −0 test/test_functions.coffee
- +2 −29 test/test_literals.coffee
- +9 −0 test/test_operations.coffee
- +10 −0 test/test_splats.coffee
| @@ -146,19 +146,23 @@ task 'loc', 'count the lines of source code in the CoffeeScript compiler', -> | ||
| runTests = (CoffeeScript) -> | ||
| startTime = Date.now() | ||
| passedTests = failedTests = 0 | ||
| - for all name, func of require 'assert' | ||
| + | ||
| + for name, func of require 'assert' | ||
| global[name] = -> | ||
| passedTests += 1 | ||
| func arguments... | ||
| + | ||
| global.eq = global.strictEqual | ||
| global.CoffeeScript = CoffeeScript | ||
| + | ||
| process.on 'exit', -> | ||
| time = ((Date.now() - startTime) / 1000).toFixed(2) | ||
| message = "passed #{passedTests} tests in #{time} seconds#{reset}" | ||
| if failedTests | ||
| log "failed #{failedTests} and #{message}", red | ||
| else | ||
| log message, green | ||
| + | ||
| fs.readdir 'test', (err, files) -> | ||
| files.forEach (file) -> | ||
| return unless file.match(/\.coffee$/i) | ||
| @@ -1,6 +1,8 @@ | ||
| +require 'rubygems' | ||
| require 'erb' | ||
| require 'fileutils' | ||
| require 'rake/testtask' | ||
| +require 'json' | ||
| desc "Build the documentation page" | ||
| task :doc do | ||
| @@ -19,3 +21,58 @@ task :doc do | ||
| end | ||
| end | ||
| +desc "Build coffee-script-source gem" | ||
| +task :gem do | ||
| + require 'rubygems' | ||
| + require 'rubygems/package' | ||
| + | ||
| + gemspec = Gem::Specification.new do |s| | ||
| + s.name = 'coffee-script-source' | ||
| + s.version = JSON.parse(File.read('package.json'))["version"] | ||
| + s.date = Time.now.strftime("%Y-%m-%d") | ||
| + | ||
| + s.homepage = "http://jashkenas.github.com/coffee-script/" | ||
| + s.summary = "The CoffeeScript Compiler" | ||
| + s.description = <<-EOS | ||
| + CoffeeScript is a little language that compiles into JavaScript. | ||
| + Underneath all of those embarrassing braces and semicolons, | ||
| + JavaScript has always had a gorgeous object model at its heart. | ||
| + CoffeeScript is an attempt to expose the good parts of JavaScript | ||
| + in a simple way. | ||
| + EOS | ||
| + | ||
| + s.files = [ | ||
| + 'lib/coffee_script/coffee-script.js', | ||
| + 'lib/coffee_script/source.rb' | ||
| + ] | ||
| + | ||
| + s.authors = ['Jeremy Ashkenas'] | ||
| + s.email = '[email protected]' | ||
| + s.rubyforge_project = 'coffee-script-source' | ||
| + end | ||
| + | ||
| + file = File.open("coffee-script-source.gem", "w") | ||
| + Gem::Package.open(file, 'w') do |pkg| | ||
| + pkg.metadata = gemspec.to_yaml | ||
| + | ||
| + path = "lib/coffee_script/source.rb" | ||
| + contents = <<-ERUBY | ||
| +module CoffeeScript | ||
| + module Source | ||
| + def self.bundled_path | ||
| + File.expand_path("../coffee-script.js", __FILE__) | ||
| + end | ||
| + end | ||
| +end | ||
| + ERUBY | ||
| + pkg.add_file_simple(path, 0644, contents.size) do |tar_io| | ||
| + tar_io.write(contents) | ||
| + end | ||
| + | ||
| + contents = File.read("extras/coffee-script.js") | ||
| + path = "lib/coffee_script/coffee-script.js" | ||
| + pkg.add_file_simple(path, 0644, contents.size) do |tar_io| | ||
| + tar_io.write(contents) | ||
| + end | ||
| + end | ||
| +end | ||
| @@ -1,7 +1,2 @@ | ||
| # Eat lunch. | ||
| -lunch = eat food for food in ['toast', 'cheese', 'wine'] | ||
| - | ||
| -# Naive collision detection. | ||
| -for roid, pos in asteroids | ||
| - for roid2 in asteroids when roid isnt roid2 | ||
| - roid.explode() if roid.overlaps roid2 | ||
| +eat food for food in ['toast', 'cheese', 'wine'] |
| @@ -1,4 +1,4 @@ | ||
| ### | ||
| -CoffeeScript Compiler v0.9.5 | ||
| +CoffeeScript Compiler v0.9.6 | ||
| Released under the MIT License | ||
| ### |
| @@ -0,0 +1,6 @@ | ||
| +numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | ||
| + | ||
| +copy = numbers[0...numbers.length] | ||
| + | ||
| +middle = copy[3..6] | ||
| + |
| @@ -0,0 +1,5 @@ | ||
| +numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | ||
| + | ||
| +numbers[3..6] = [-3, -4, -5, -6] | ||
| + | ||
| + |
| @@ -76,6 +76,11 @@ code, pre, tt, textarea { | ||
| margin-left: 0; | ||
| padding-left: 0; | ||
| } | ||
| +.timestamp { | ||
| + font-size: 12px; | ||
| + font-weight: normal; | ||
| + color: black; | ||
| +} | ||
| div.code { | ||
| position: relative; | ||
| border: 1px solid #cacaca; | ||
| @@ -31,7 +31,7 @@ | ||
| <span class="nv">options = </span><span class="nx">oparse</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">args</span><span class="p">)</span> | ||
| <span class="nx">invoke</span> <span class="nx">arg</span> <span class="k">for</span> <span class="nx">arg</span> <span class="k">in</span> <span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">¶</a> </div> <p>Display the list of Cake tasks in a format similar to <code>rake -T</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">printTasks = </span><span class="o">-></span> | ||
| <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s1">''</span> | ||
| - <span class="k">for</span> <span class="nx">all</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">task</span> <span class="k">of</span> <span class="nx">tasks</span> | ||
| + <span class="k">for</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">task</span> <span class="k">of</span> <span class="nx">tasks</span> | ||
| <span class="nv">spaces = </span><span class="mi">20</span> <span class="o">-</span> <span class="nx">name</span><span class="p">.</span><span class="nx">length</span> | ||
| <span class="nv">spaces = </span><span class="k">if</span> <span class="nx">spaces</span> <span class="o">></span> <span class="mi">0</span> <span class="k">then</span> <span class="nb">Array</span><span class="p">(</span><span class="nx">spaces</span> <span class="o">+</span> <span class="mi">1</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s1">' '</span><span class="p">)</span> <span class="k">else</span> <span class="s1">''</span> | ||
| <span class="nv">desc = </span><span class="k">if</span> <span class="nx">task</span><span class="p">.</span><span class="nx">description</span> <span class="k">then</span> <span class="s2">"# #{task.description}"</span> <span class="k">else</span> <span class="s1">''</span> | ||
| @@ -12,7 +12,7 @@ | ||
| <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="nx">filename</span><span class="p">,</span> <span class="s1">'utf8'</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">'.coffee'</span><span class="p">,</span> <span class="p">(</span><span class="nx">content</span><span class="p">)</span> <span class="o">-></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">¶</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">'0.9.5'</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">¶</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">'./helpers'</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">¶</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">'.coffee'</span><span class="p">,</span> <span class="p">(</span><span class="nx">content</span><span class="p">)</span> <span class="o">-></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">¶</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">'0.9.6'</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">¶</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">'./helpers'</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">¶</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="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nv">options = </span><span class="p">{})</span> <span class="o">-></span> | ||
| <span class="k">try</span> | ||
| <span class="p">(</span><span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">code</span><span class="p">).</span><span class="nx">compile</span> <span class="nx">options</span> | ||
Showing you all comments on commits in this comparison.
|
Timestamp didn't get bumped, no big deal. Could change that line to |
|
Why'd you get rid of this case? I liked the |
|
Wouldn't it be less computationally expensive to pull the |
|
Can you be more specific?
|
|
In short, read scope.coffee. |
|
I cant believe my eyes... http://jsperf.com/array-prototype-splice-retrieval I'd like to see if these numbers are consistent on other browsers/platforms. How can |
|
It's JavaScript, man ... take nothing for granted (especially in IE). |
|
The weirdest part is that the fourth test case ( |
|
And here's how it's broken |
|
Yep, I see now. I will push a fix when I wake up in a few hours. Thanks for the example and for catching this bug. |
|
A rare case, but I believe
should be |
|
@badboy: Can you open an issue for this? Thanks in advance. |