Skip to content

Conversation

kamilogorek
Copy link
Contributor

Ref: #1104
Based on: angular/zone.js#686

@kamilogorek kamilogorek requested a review from a team October 30, 2017 15:33
@mitsuhiko
Copy link
Contributor

So I was looking at this before and I rejected doing it for a reason. I do not remember which one :(

Let me recollect my thoughts before I approve this.

@kamilogorek
Copy link
Contributor Author

Sure, I'm not quite convinced if this is the best solution as well.
Opened PR so that we can discuss + run tests on SL.

@kamilogorek
Copy link
Contributor Author

@benvinegar maybe you can chime in?

@MaxBittker
Copy link
Contributor

eslint doesn't know who it's dealing with 😂

@jan-auer
Copy link
Member

Apart from the general approach, shouldn't you invoke f.toString() instead of the prototype function in the tests?

@kamilogorek
Copy link
Contributor Author

kamilogorek commented Oct 31, 2017

@jan-auer it's the same call when it comes to type coercion in JS

function foo () {
  return 'hello'
}

foo.toString()
// "function foo() {
//   return 'hello'
// }"

Function.prototype.toString.apply(foo)
// "function foo() {
//   return 'hello'
// }"

also:

foo.toString === Function.prototype.toString
// true

@jan-auer
Copy link
Member

@kamilogorek I get that. But you're patching toString for those functions - I assume (?) - and then calling the non-patched version in tests.

@kamilogorek
Copy link
Contributor Author

No, I patch F.prototype.toString :)

@jan-auer
Copy link
Member

gotcha

@kamilogorek
Copy link
Contributor Author

Approved via Slack

@kamilogorek kamilogorek merged commit cf89f86 into master Oct 31, 2017
@kamilogorek kamilogorek deleted the is-native branch October 31, 2017 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants