-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
review 1: feature: search for CtVariableReference in defined scope #1193
Conversation
26c8068
to
8fe9042
Compare
8fe9042
to
da240cd
Compare
This PR looks good to me, it's a big refactoring of recent code. Could you document the expectations and contracts for the implementors in the Javadoc of abstract method |
Documentation was updated. |
I have a concern with the design of the abstract method While I understand well the
My proposal would thus be that the context is an internal object, under the responsibility of What do you think? |
I probably understand the problem you see. I would agree with You in case when the
It cannot work, because it really needs to register that listener. And the only code which can register it is the implementation of createScopeQuery. |
Ideas: I3) optinally Then we might remove all 3 child classes, because they are nearly empty now. Or we can keep them empty... |
That's a good idea, thanks Pavel for the constructive proposition.
I prefer strong encapsulation over questionable design (even if it's internal).
To avoid the not-so-nice sequence of instanceof, we can use a custom visitor, and then simply write
`variable.accept(new VariableReferenceVisitor())`
|
f0b05c7
to
2a28bba
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.6.0-20170315.164827-83 New API: fr.inria.gforge.spoon:spoon-core:jar:5.6.0-SNAPSHOT Detected changes: 8. Change 1
Change 1
Change 2
Change 2
Change 2
Change 3
Change 3
Change 3
Change 4
Change 4
Change 5
Change 5
Change 5
Change 6
Change 7
Change 8
|
What about this implementation? |
I like this better, thanks. To me it seems ready for merge.
Why? I would say it is correct |
for me too :-) I can proceed faster with less opened PRs :-) Rebasing is not so funny like improving awesome spoon code. Next PR for review is #1005 please. |
There are two things:
XxxScopeFunction
have constructor withCtScannerListener
parameter.XxxReferenceFunction
have constructor withvar
parameter. Such functions will search for references ofvar
in children of mapping function inputCtElement
The classes
LocalVariableReferenceFunction
,CatchVariableReferenceFunction
,ParameterReferenceFunction
has similar algorithm, so they inherit fromAbstractVariableReferenceFunction
. TheFieldReferenceFunction
is implemented individually, because java field references behaves different.These improvements are needed by #1005.