forked from jashkenas/coffeescript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First successful test of a little test script. Need to massage the lo…
…cal runtime a little bit better.
- Loading branch information
Showing
8 changed files
with
144 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
|
|||
#======================================================================= | |||
|
|||
makeDeferReturn = (obj, defer_args, id) -> | |||
ret = (inner_args...) -> | |||
defer_args?.assign_fn?.apply(null, inner_args) | |||
obj._fulfill id | |||
|
|||
if defer_args | |||
ret.__tame_trace = {} | |||
for k in [ "parent_cb", "file", "line", "func_name" ] | |||
ret.__tame_trace[k] = defer_args[k] | |||
|
|||
ret | |||
|
|||
#======================================================================= | |||
# Deferrals | |||
# | |||
# A collection of Deferrals that can | |||
# | |||
exports.Deferrals = class Deferrals | |||
|
|||
constructor: (k) -> | |||
@continuation = k | |||
@count = 1 | |||
|
|||
_fulfill : -> | |||
@continuation() if --@count == 0 | |||
|
|||
defer : (args) -> | |||
@count++ | |||
self = this | |||
return makeDeferReturn self, args, null | |||
|
|||
#======================================================================= |