-
Notifications
You must be signed in to change notification settings - Fork 142
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
imitate / replace things deeply (instead of shallow) #268
Commits on Jun 21, 2017
-
Fix the repl by using useGlobal
This was causing all our metaprogramming that checked types to break. See: nodejs/node#13827
Configuration menu - View commit details
-
Copy full SHA for c6c3ff0 - Browse repository at this point
Copy the full SHA c6c3ff0View commit details
Commits on Jun 22, 2017
-
Rework prop utilities to grab and pass descriptors
This is necessary for avoiding cases where even accessing the property will set off a getter, or blow up in strict mode (e.g. accessing arguments or caller/callee on something). Instead, we'll look at the descriptor's `value` property, which is relatively "inert" by comparison
Configuration menu - View commit details
-
Copy full SHA for adea88c - Browse repository at this point
Copy the full SHA adea88cView commit details -
Avoid copying & then mutating by accepting a visit
When copying props, you can adjust the value with a func arg
Configuration menu - View commit details
-
Copy full SHA for c451e72 - Browse repository at this point
Copy the full SHA c451e72View commit details -
Rough draft of this imitation func
Does not work but figured like I may as well save my place
Configuration menu - View commit details
-
Copy full SHA for 3f7c935 - Browse repository at this point
Copy the full SHA 3f7c935View commit details -
Should overwrite fields, but only if they're both writable & configurable. If the target has a field that's somehow neither of these, then it's almost certainly some kind of built-in like Function.prototype.length
Configuration menu - View commit details
-
Copy full SHA for a86905a - Browse repository at this point
Copy the full SHA a86905aView commit details -
It no longer needs the original because it has the full property descriptor
Configuration menu - View commit details
-
Copy full SHA for 37ca57c - Browse repository at this point
Copy the full SHA 37ca57cView commit details -
Get basic imitation working as desired
This required using the most-valuey of types as base cases in the recursion, because it'd muck with the perceived value of things like Date and moreover would fake 30+ string methods for probably zero benefit and lots of confusion. (Only affects boxed instances of these prims)
Configuration menu - View commit details
-
Copy full SHA for 590c50c - Browse repository at this point
Copy the full SHA 590c50cView commit details -
Surprisingly lodash isEqual fails on two errors but only if one is cloned. Meanwhile, assert module will pass deepEqual on two errors if the messages differ. Fantastic
Configuration menu - View commit details
-
Copy full SHA for 8469b45 - Browse repository at this point
Copy the full SHA 8469b45View commit details -
Configuration menu - View commit details
-
Copy full SHA for b4f6eea - Browse repository at this point
Copy the full SHA b4f6eeaView commit details -
Get more serious about improving naming.
Push all the naming chains into the imitation object, since it's the only call site with sufficient context
Configuration menu - View commit details
-
Copy full SHA for 11d8dfd - Browse repository at this point
Copy the full SHA 11d8dfdView commit details
Commits on Jun 23, 2017
-
This got the tests passing, but may save us the need for extending types options (thanks to just using prototype and not class syntax)
Configuration menu - View commit details
-
Copy full SHA for d83f661 - Browse repository at this point
Copy the full SHA d83f661View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd437a2 - Browse repository at this point
Copy the full SHA dd437a2View commit details -
Get this working under phantom (Map, Symbol)
Add a Map polyfill to get things working under older browsers, also refer to Symbol in such a way that it's backwards compatible
Configuration menu - View commit details
-
Copy full SHA for 14d62b1 - Browse repository at this point
Copy the full SHA 14d62b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for b5e952c - Browse repository at this point
Copy the full SHA b5e952cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1a48ede - Browse repository at this point
Copy the full SHA 1a48edeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 519cd58 - Browse repository at this point
Copy the full SHA 519cd58View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f66b8e - Browse repository at this point
Copy the full SHA 0f66b8eView commit details -
Add a test suggesting instanceof checks work
I did this in an example project to be sure it was a native (not transpiled) class being "extended" by td.js. This is the case that was failing during the 2.x series and necessitated the extendCo… option for 3.x This test passes, so we can delete that option next
Configuration menu - View commit details
-
Copy full SHA for 074d307 - Browse repository at this point
Copy the full SHA 074d307View commit details -
Remove extendWhenReplacingConstructors option
The improvements in the new imitate function sidestep the babel class extension issue that prompted the introduction of this option. All fakes will pass instanceof checks as a matter of course now. Of course, this means that a major bump will be necessary, since that config option will have been removed and anyone setting it will blow up…
Configuration menu - View commit details
-
Copy full SHA for f61995b - Browse repository at this point
Copy the full SHA f61995bView commit details -
Spare ourselves the major bump by deprecating prop
I feel like I earn 3 points for lazily giving people a let-me-github-that-for-you URL and lose 2 points for lazily pasting in an error message
Configuration menu - View commit details
-
Copy full SHA for 55d58fe - Browse repository at this point
Copy the full SHA 55d58feView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7ef2b5d - Browse repository at this point
Copy the full SHA 7ef2b5dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f15650 - Browse repository at this point
Copy the full SHA 5f15650View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3fd25b5 - Browse repository at this point
Copy the full SHA 3fd25b5View commit details -
Move unit tests under test/unit
Doing this in prep of adding a second teenytest suite under test/safe
Configuration menu - View commit details
-
Copy full SHA for d3b09fb - Browse repository at this point
Copy the full SHA d3b09fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for fbb1fbf - Browse repository at this point
Copy the full SHA fbb1fbfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1b2c936 - Browse repository at this point
Copy the full SHA 1b2c936View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9aded7b - Browse repository at this point
Copy the full SHA 9aded7bView commit details -
Start detangling imitiate as prefactoring
Also we stopped printing '#' as shorthand for 'prototype'. It was complicating the code, and on further reflection it makes the messages harder for anyone who's not "in the know" with respect to '#' being a symbol for "instance method" (as opposed to '.' for plain function)
Configuration menu - View commit details
-
Copy full SHA for dc2a4d5 - Browse repository at this point
Copy the full SHA dc2a4d5View commit details -
Pair with @andrewvida to refactor imitate()
This refactor started by teasing the tangled function into its separate roles, then pushing the behavior down into 3 new units. The unit test for the refactored thing is particularly interesting, because it required use of argument captors to trigger the downstream behavior. This was necessary because the method was recursive, and we needed to invoke the subject twice, once indirectly. It's hard to find good examples of argument captors, so here you go.
Configuration menu - View commit details
-
Copy full SHA for c0e8b21 - Browse repository at this point
Copy the full SHA c0e8b21View commit details
Commits on Jun 24, 2017
-
Drive out a fresh impl of initialize-names
Turns out most of the logic was pretty dumb and it's new behavior so I just axed most of it
Configuration menu - View commit details
-
Copy full SHA for 37ccdc8 - Browse repository at this point
Copy the full SHA 37ccdc8View commit details -
Test the thing that creates the root fakes
These are just the node-level replacement, their properties (or for arrays, elements) will be replaced by overwriteChildren Simplied somewhat, when I learned through the test that underscore's clone works well enough for primitives (one would trust, efficiently enough)
Configuration menu - View commit details
-
Copy full SHA for f3145e5 - Browse repository at this point
Copy the full SHA f3145e5View commit details -
Pushed down 4 things in overwrite children
Lots of complexity got swept under this rug, really causing some pain at the periphery. Since it's a leaf node, will I ever look at it again? Probably not. Some notes: * ../../../.. is outrageous. I should figure out how to go about getting the unit tests colocated with the source soon. * 5 arguments for chain-prototype.js? Seriously? That can't be necessary * This overwrite-children/index test is really the kitchen sink of edge cases for delegator objects. It has replaced deps, it has one-off test double functions passed as arguments, it has argument captors for getting callbacks under isolated tests, it has verifications that certain dependencies were absolutely not called. It's got it all! All of these are smells that this unit is weird/awkward. It's possible that things got complex because the code originated while trying to tidy up the behavior originally in the context of a big method with lots of closure-scoped variables available. That explains the 5 arg function (once extracted and closure-scope is lost), as well as the visitor pattern sort of callbacks to keep the recursion step out-of-sight of the extracted unit. Unsure how I'd rework it at this point to breathe like a normal function, though. That's why I should have test-drove this from scratch instead of test-aftering and pushing down all these things! Whoops!
Configuration menu - View commit details
-
Copy full SHA for a353f1d - Browse repository at this point
Copy the full SHA a353f1dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 92f1354 - Browse repository at this point
Copy the full SHA 92f1354View commit details -
Configuration menu - View commit details
-
Copy full SHA for 754fd79 - Browse repository at this point
Copy the full SHA 754fd79View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d7fb8d - Browse repository at this point
Copy the full SHA 9d7fb8dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 76093c1 - Browse repository at this point
Copy the full SHA 76093c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2fce02b - Browse repository at this point
Copy the full SHA 2fce02bView commit details