Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ptp-dev] Photran: Remove unused local variables refactoring with multiple modules in a file

Dear eclipse (photran) developers


First of all thanks for this great IDE, I have used it for quite some time and it has awesome features.


Up to now I have only used eclipse for developing, but never developed anything for eclipse. I ran into a bug in photran's  "Remove unused local variables refactoring" when multiple modules are present in the same file and I thought I might fix it.


However I have some questions regarding the source code that I would like to have some understanding of, before I start tampering with the code.


The problem is in photran's "ScopingNode.java" (org.eclipse.photran.internal.core.analysis.binding) at the call


this.getRepresentativeToken().followIncoming(EdgeType.DEFINED_IN_SCOPE_EDGE_TYPE);


This function call returns the edges of all the modules defined in a file, not just the edges of the scope it was called with. And the edges seem to come in strange order. In debug view the above function returns the following edges (for the attached sample f90):


[Edge of type 0 from (Offset 57, length 8 in /test/main.f90) to (Offset 100, length 4 in /test/main.f90), Edge of type 0 from (Offset 166, length 1 in /test/main.f90) to (Offset 100, length 4 in /test/main.f90)]


So I wanted to ask here to better understand what the code does and why it does it, before I mess around. My questions would be:


1) Why is the second edge backwards? Offset 166 -> Offset 100? Is that on purpose or part of the bug?

2) What is the length of an edge?

3) The argument EdgeType.DEFINED_IN_SCOPE_EDGE_TYPE indicates to me that "followIncoming" is supposed to restrict its result to the scope for which it was called. So the proper place to fix it would be within that function (or maybe one of the functions called by it, depending on where this behavior is caused)? I ask because the implementation and declaration of the function is rather confusing and it will take me quite some time to dig into there.


This is the first time I am contributing to a larger open source project, so please forgive any if I ignored any rules or best practices or standard procedures. I am glad for all feedback and help.


Thanks a lot


Benedikt





Attachment: test.f90
Description: test.f90


Back to the top