inconsistent export behavior #165

Closed
andrewrk opened this Issue Sep 5, 2012 · 1 comment

Projects

None yet

2 participants

andrewrk commented Sep 5, 2012

http://satyr.github.com/cup/#c:export%20const%20foo1%20=%20-%3E%20%22hi%22%0A%0Aconst%20foo2%20=%20-%3E%20%22hi%22%0Aexport%20foo2

code:

export const foo1 = -> "hi"

const foo2 = -> "hi"
export foo2

expected:

var foo1, foo2, out$ = typeof exports != 'undefined' && exports || this;
foo1 = function(){
  return "hi";
};
out$.foo1 = foo1;
foo2 = function(){
  return "hi";
};
out$.foo2 = foo2;

actual:

var foo1, foo2, out$ = typeof exports != 'undefined' && exports || this;
import$(out$, foo1 = function(){
  return "hi";
});
foo2 = function(){
  return "hi";
};
out$.foo2 = foo2;
function import$(obj, src){
  var own = {}.hasOwnProperty;
  for (var key in src) if (own.call(src, key)) obj[key] = src[key];
  return obj;
}
Owner
satyr commented Sep 5, 2012

Looks like I forgot to make it unroll sub-blocks and managed to write a wrong test. Fixing.

@satyr satyr closed this in bb5b5a3 Sep 5, 2012
@andrewrk andrewrk added a commit to andrewrk/chem that referenced this issue Sep 7, 2012
@andrewrk andrewrk update jspackage to 0.4.9, work around for satyr/coco#165 837252f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment