Skip to content
Browse files

tweak and tune the header code

  • Loading branch information...
1 parent 3856f07 commit 332fff2179fd312e5679a907347e9ba162e19e56 @maxtaco committed
Showing with 25 additions and 26 deletions.
  1. +6 −8 lib/coffee-script/nodes.js
  2. +19 −18 src/nodes.coffee
View
14 lib/coffee-script/nodes.js
@@ -2946,10 +2946,10 @@
InlineDeferral = {
generate: function() {
- var a1, af, apply_call, assignments, body, call_meth, cn, cnt, cnt_member, constructor_assign, constructor_body, constructor_code, constructor_name, constructor_params, decr, defer_assign, defer_body, defer_code, defer_name, defer_params, dp, empty, if_body, if_cond, if_expr, inc, inner_body, inner_code, inner_params, ip, k, k_member, klass, klass_assign, my_apply, my_if, my_null, ns, ns_access, obj, p1, tame_init, _fulfill_assign, _fulfill_body, _fulfill_call, _fulfill_code, _fulfill_method, _fulfill_name;
+ var a1, af, apply_call, assignments, body, call_meth, cn, cnt, cnt_member, constructor_assign, constructor_body, constructor_code, constructor_name, constructor_params, decr, defer_assign, defer_body, defer_code, defer_name, defer_params, dp, if_body, if_cond, if_expr, inc, inner_body, inner_code, inner_params, ip, k, k_member, klass, klass_assign, my_apply, my_if, my_null, ns, ns_obj, ns_val, obj, p1, _fulfill_assign, _fulfill_body, _fulfill_call, _fulfill_code, _fulfill_method, _fulfill_name;
k = new Literal("continuation");
cnt = new Literal("count");
- cn = new Literal(tame["const"].Deferrals);
+ cn = new Value(new Literal(tame["const"].Deferrals));
ns = new Value(new Literal(tame["const"].ns));
k_member = new Value(new Literal("this"));
k_member.add(new Access(k));
@@ -2996,12 +2996,10 @@
obj = new Obj(assignments, true);
body = new Block([new Value(obj)]);
klass = new Class(null, null, body);
- ns_access = ns.copy();
- ns_access.add(new Access(cn));
- klass_assign = new Assign(ns_access, klass);
- empty = new Obj([]);
- tame_init = new Assign(ns, empty);
- return new Block([tame_init, klass_assign]);
+ klass_assign = new Assign(cn, klass, "object");
+ ns_obj = new Obj([klass_assign], true);
+ ns_val = new Value(ns_obj);
+ return new Assign(ns, ns_val);
}
};
View
37 src/nodes.coffee
@@ -2363,23 +2363,22 @@ InlineDeferral =
# Generate this code, inline. Is there a better way?
#
- # class __Deferrals
- # constructor: (@continuation) ->
- # @count = 1
- # _fulfill : ->
- # @continuation if ! --@count
- # defer : (defer_params) ->
- # @count++
- # (inner_params...) =>
- # defer_params?.assign_fn?.apply(null, inner_params)
- # @_fulfill()
# tame =
- # Deferrals : __Deferrals
+ # Deferrals : class
+ # constructor: (@continuation) ->
+ # @count = 1
+ # _fulfill : ->
+ # @continuation if ! --@count
+ # defer : (defer_params) ->
+ # @count++
+ # (inner_params...) =>
+ # defer_params?.assign_fn?.apply(null, inner_params)
+ # @_fulfill()
#
generate : ->
k = new Literal "continuation"
cnt = new Literal "count"
- cn = new Literal tame.const.Deferrals
+ cn = new Value new Literal tame.const.Deferrals
ns = new Value new Literal tame.const.ns
# make the constructor:
@@ -2448,12 +2447,14 @@ InlineDeferral =
obj = new Obj assignments, true
body = new Block [ new Value obj ]
klass = new Class null, null, body
- ns_access = ns.copy()
- ns_access.add new Access cn
- klass_assign = new Assign ns_access, klass
- empty = new Obj []
- tame_init = new Assign ns, empty
- new Block [ tame_init, klass_assign ]
+
+ # tame =
+ # Deferrals : <class>
+ #
+ klass_assign = new Assign cn, klass, "object"
+ ns_obj = new Obj [ klass_assign ], true
+ ns_val = new Value ns_obj
+ new Assign ns, ns_val
# Unfold a node's child if soak, then tuck the node under created `If`
unfoldSoak = (o, parent, name) ->

0 comments on commit 332fff2

Please sign in to comment.
Something went wrong with that request. Please try again.