Skip to content
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 LocalVariableReferenceFunction, LocalVariableScopeFunction #1144

Merged
merged 3 commits into from
Jan 30, 2017

Conversation

pvojtechovsky
Copy link
Collaborator

This PR contains LocalVariableReferenceFunction, LocalVariableScopeFunction.
The main purpose is LocalVariableReferenceFunction, which returns all the references to the local variable. The second on is helper classes which might be useful for others so it is public.

It depends on PR CtQuery#filterChildren(null) #1140

The tests will be added later, because they share a lot with tests of #1136

@pvojtechovsky pvojtechovsky changed the title WIP LocalVariableReferenceFunction, LocalVariableScopeFunction review LocalVariableReferenceFunction, LocalVariableScopeFunction Jan 25, 2017
public void apply(CtLocalVariable<?> localVariable, CtConsumer<Object> outputConsumer) {
CtStatementList statements = localVariable.getParent(CtStatementList.class);
if (statements == null) {
//cannot search for parameter references of parameter which has no executable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong comment I think. But don't you want to tests emptyness of the statementList here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment was wrong. Thanks. The check for statement.isEmpty() is not needed because it later searches in the statements list and throws exception in case of empty collection too. So this case is handled too.

@surli surli merged commit 8e7d456 into INRIA:master Jan 30, 2017
@pvojtechovsky pvojtechovsky deleted the LocalVariableReferenceFunction branch January 30, 2017 17:57
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.

2 participants