-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Improve function interop #1074
Improve function interop #1074
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -959,10 +959,9 @@ private object ToObject(ObjectTraverseStack stack) | |
break; | ||
|
||
case ObjectClass.Function: | ||
if (this is FunctionInstance function) | ||
if (this is ICallable function) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a PR trying to hide ICallable and possibly trying to remove it at some point altogether if possible. In spec there are function objects (in Jint FunctionInstance) that may be callable ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you suggesting I should check Also this function is for converting script objects to their CLR counterpart. I don't think anything other than a function should be converted to a CLR function. So, proxies will not be hitting this line anyway. As for removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this was just a note. Proxy is a good example that function object might not be callable, even though it has to implement The more test coverage the better. Always comes back biting for advanced usage that people like you have when doing interop. All coverage is much appreciated! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok. It was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah the BoundFunction... OK that was the pain point we discussed earlier. Well it's a start to make |
||
{ | ||
converted = new Func<JsValue, JsValue[], JsValue>( | ||
(thisVal, args) => function.Engine.Invoke(function, (object) thisVal, args)); | ||
converted = (Func<JsValue, JsValue[], JsValue>) function.Call; | ||
} | ||
|
||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this change is required (because
_activeEvaluationContext
is used this way everywhere else). My app was crashing because of this, but I could not write a test which reproduces the issue in isolation.