Skip to content

Commit

Permalink
Add Implicit Async Functions (#3757)
Browse files Browse the repository at this point in the history
* changed jison acceptable versions

* added await support

* wrong function bug fix

* added tests for async/await

* invalid to have await, yield(from) in same function

* changed error handling and tests

* bug fix

* made error handling test more rigorous

* consolidated harmony test files

* added async constructor support and tests

* removed .orig files

* Fixed browser testing issue

* Minor cleanup

* Async test-suite and Cake support, simplified/removed funky tests

* Skip async/await tests when not supported in runtime

* cleanup

* Replaced polyfill with native JS async/await

* Oops

* Make 'async' reserved word

* Remove all async polyfills

* fix merge conflict

* make async testing opt-in

* restore test, remove confusing polyfill language

* Revert changes to test runners

* Only run async tests where async/await is supported (Node 7+ with --harmony, for now)

* remove 'async' from JS reserved words

* The async tests should use their own special async-capable version of `global.test`, which is only loaded for the async tests and only loaded by async-capable environments

* Reverting rename of `async`, it’s not a reserved word so there’s no longer a need for this change

* async test refactoring and additions

* oops

* sync

* better error reporting for `await`

* more stuff geoffrey wants

* fixed litcoffee tests

* change test title
  • Loading branch information
GabrielRatener authored and GeoffreyBooth committed Nov 2, 2016
1 parent a1bcf7f commit 496fd5d
Show file tree
Hide file tree
Showing 13 changed files with 538 additions and 210 deletions.
20 changes: 12 additions & 8 deletions Cakefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,14 @@ task 'bench', 'quick benchmark of compilation time', ->
# Run the CoffeeScript test suite.
runTests = (CoffeeScript) ->
CoffeeScript.register()
startTime = Date.now()
currentFile = null
passedTests = 0
failures = []
startTime = Date.now()

# These are attached to `global` so that they’re accessible from within
# `test/async.coffee`, which has an async-capable version of
# `global.test`.
global.currentFile = null
global.passedTests = 0
global.failures = []

global[name] = func for name, func of require 'assert'

Expand Down Expand Up @@ -288,10 +292,10 @@ runTests = (CoffeeScript) ->
# Run every test in the `test` folder, recording failures.
files = fs.readdirSync 'test'

# Ignore generators test file if generators are not available
generatorsAreAvailable = '--harmony' in process.execArgv or
'--harmony-generators' in process.execArgv
files.splice files.indexOf('generators.coffee'), 1 if not generatorsAreAvailable
# Ignore async test file if async/await is not available
asyncSupported = parseInt(process.versions.node.split('.')[0]) >= 7 and
('--harmony' in process.execArgv or '--harmony-async-await' in process.execArgv)
files.splice files.indexOf('async.coffee'), 1 unless asyncSupported

for file in files when helpers.isCoffee file
literate = helpers.isLiterate file
Expand Down
7 changes: 6 additions & 1 deletion extras/coffee-script.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions lib/coffee-script/grammar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffee-script/lexer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 51 additions & 11 deletions lib/coffee-script/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 496fd5d

Please sign in to comment.