JavaScript: Restructure implementation of DataFlow::SourceNode.#727
Conversation
ghost
left a comment
There was a problem hiding this comment.
Implementation LGTM.
The improvements seem impressive. Well done.
Are you sure that the improvements aren't due to the change I have flagged as unrelated to the purpose of this PR?
For the record: the introduction of yet another style/naming scheme for working around the quirks of abstract classes is a bit unfortunate. We now have:
InvokeNode/InvokeNodeDefClientRequest/CustomClientRequestSourceNode/SourceNode::Range- probably more
I agree. Which of the other ones would you like me to switch to? |
|
I like this change a lot. I also like the Long ago I started a write-up on a canonical naming scheme here but I gave up on rolling it out after the miserable performance I saw in the string concatenation library. |
|
I also prefer the |
It now uses a facade pattern similar to `InvokeNode`: the range of the class is defined by an abstract class `DataFlow::SourceNode::Range`, while the actual behaviour is defined by the (no longer abstract) `SourceNode` class itself. Clients that want to add new source nodes need to extend `DataFlow::SourceNode::Range`, those that want to refine the behaviour of existing source nodes should extend `DataFlow::SourceNode` itself. While this is technically a breaking API change, I think separating the two aspects in this way is cleaner and makes it easier to use, and improves performance as well.
ef1d08d to
de42975
Compare
|
I've rebased to resolve conflicts with the autoformatting PR. Two further minor API-related questions are perhaps worth discussing:
|
|
I think we should keep the API as is:
|
It now uses a facade pattern similar to
InvokeNode: the range of the class is defined by an abstract classDataFlow::SourceNode::Range, while the actual behaviour is defined by the (no longer abstract)SourceNodeclass itself.Clients that want to add new source nodes need to extend
DataFlow::SourceNode::Range, those that want to refine the behaviour of existing source nodes should extendDataFlow::SourceNodeitself.While this is technically a breaking API change, I think separating the two aspects in this way is cleaner and makes it easier to use, and improves performance (internal link) as well.