Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed bound constructor with backcall

  • Loading branch information...
commit 6117604f8576833c9b8b88f6047596b78b0a90eb 1 parent 0804bc3
@satyr authored
Showing with 7 additions and 3 deletions.
  1. +1 −1  lib/ast.js
  2. +1 −1  src/ast.co
  3. +5 −1 test/oo.co
View
2  lib/ast.js
@@ -2199,7 +2199,7 @@ exports.Fun = Fun = (function(superclass){
if (this.bound === 'this$') {
if (this.ctor) {
scope.assign('this$', 'this instanceof ctor$ ? this : new ctor$');
- body.add(Return(Literal('this$')));
+ body.lines.push(Return(Literal('this$')));
} else if (that = (ref$ = sscope.fun) != null ? ref$.bound : void 8) {
this.bound = that;
} else {
View
2  src/ast.co
@@ -1344,7 +1344,7 @@ class exports.Fun extends Node
if @bound is \this$
if @ctor
scope.assign \this$ 'this instanceof ctor$ ? this : new ctor$'
- body.add Return Literal \this$
+ body.lines.push Return Literal \this$
else if sscope.fun?bound
then @bound = that
else sscope.assign \this$ \this
View
6 test/oo.co
@@ -147,7 +147,11 @@ class BoundCtor extends (-> {@attr})
eq super(...).attr, @attr
@method = ~> this
-class BoundChild extends BoundCtor then ~> super ...
+class BoundChild extends BoundCtor
+ ~>
+ super ...
+ # Auto-`return this` even with backcall.
+ <- Object
for C of [BoundCtor, BoundChild]
bc = C 'attr'
Please sign in to comment.
Something went wrong with that request. Please try again.