-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Add backwards-compatible predicates to SocketIO #3262
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: Add backwards-compatible predicates to SocketIO #3262
Conversation
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.
Mostly fine. But you got a return-type wrong, and I think we can make the getAck
predicates prettier.
(I found a spelling mistake: RecieveCallback
needs to be ReceiveCallback
, could you ninja-edit that into this PR?)
result = getListener().getLastParameter() and | ||
exists(result.getAnInvocation()) |
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.
result = getListener().getLastParameter() and | |
exists(result.getAnInvocation()) | |
result.(ReceiveCallback).getReceiveNode() = this |
And then add a getReceiveNode
in ReceiveCallback
.
You could change the return-type to ReceiveCallback
?
And similar in the other getAck
predicates.
(SendNode::getAck
returns SendCallback
).
SendNode getASender() { result.getAReceiver() = this } | ||
|
||
/** Gets the acknowledgment callback, if any. */ | ||
DataFlow::FunctionNode getAck() { |
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.
DataFlow::FunctionNode getAck() { | |
DataFlow::SourceNode getAck() { |
The two getAck
methods on the ReceiveNode
classes returned a DataFlow::SourceNode
in the previous API.
(The getAck
methods on SendNode
did return DataFlow::FunctionNode
in the previous API, so those are fine).
(If you change the return-types to SendCallback
/ReceiveCallback
as suggested in the below, then that will ensure the correct return-type).
DataFlow::SourceNode getAReceivedItem() { result = getReceivedItem(_) } | ||
|
||
/** Gets the acknowledgment callback, if any. */ | ||
DataFlow::FunctionNode getAck() { |
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.
DataFlow::FunctionNode getAck() { | |
DataFlow::SourceNode getAck() { |
This is the second getAck
that returned a DataFlow::SourceNode
in the previous API.
/** | ||
* DEPRECATED. Always returns `this` as a `ServerObject` now represents the origin of a server. | ||
* | ||
* Instead of `getOrigin()` to get a server origin from a reference, use `ServerObject.ref()` to get references to a given server. | ||
*/ | ||
deprecated DataFlow::SourceNode getOrigin() { result = this } |
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.
The QLDoc is not quite accurate.
In the previous API the ServerObject
class was of type TServer
, and there was a one-to-one relation between TServer
and a SourceNode
origin.
The getOrigin
method extracted the SourceNode
origin from the TServer
. (One can say the method converted between the two representations).
It didn't have anything to do with references like .ref()
.
(References are handled by the ServerNode
class, and I kept that part of the API).
I think you can just remove the second line of the QLDoc, and then its fine.
Thanks. PTAL |
Could you change the other 3 |
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.
👍
Makes the API exposed by
SocketIO
backwards compatible with clients from the 1.23 release.There are no DIL changes so an evaluation shouldn't be necessary.