-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS Null and Undefined objects are not treated correctly in .call and .appl #38
Comments
That particular version is the "command line version", which has external dependencies on Node.js The coffee script core compiler: http://jashkenas.github.com/coffee-script/extras/coffee-script.js Could you try the core compiler version? |
The two urls have the same content, the core compiler. http://jashkenas.github.com/coffee-script/extras/coffee-script.js But I made sure, same result with both versions. |
I'll look into this and see if I can re-produce it over the weekend, to busy with work this week to have time right now, sadly. |
This looks like an issue with the Function.prototype.call method. (Native.Function.fs, lines 131 though 133) We are generating a delegate to call, based on the types of the parameters passed in. For example (min repro): var foo = function (a, b, c, d, e, f) { print('bleh'); };
var me = "";
foo.call(me, 1, 'a', undefined, null); results in: Whereas it should probably result in: |
I'm not 100% sure what the fix should be, here. It seems to me that the Otherwise, we need to change line 132 to read: let argsClr = args |> Array.map (fun i -> if not i.IsNull && i.IsClr then TC.ToClrObject i else i :> obj) This does, in fact, allow the above example to work. |
I opted to use the latter definition, in order to preserve all previous usages of TC.ToClrObject. |
The fix lets the code run w/o errors, that said, the results aren't correct yet. Compiling this CoffeeScript fragment var ;
foo(function() {
var ;
return 1;
}); but the correct result looks like foo(function() {
return 1;
}); |
@ScottWeinstien, would you mind posting that as a separate bug?
|
It might be too early for this to work, but I was playing w/ the idea of using CoffeeScript from IronJS.
So I have the following minimal snippet
but I get the following error on the last line:
System.Reflection.TargetInvocationException was unhandled
Message: Exception has been thrown by the target of an invocation.
at IronJS.Hosting.FSharp.run(Delegate compiled, T t) in GitHub\IronJS\Src\IronJS\Hosting.fs:line 178
at IronJS.Hosting.FSharp.execute(String source, T t) in GitHub\IronJS\Src\IronJS\Hosting.fs:line 200
The text was updated successfully, but these errors were encountered: