Skip to content

Extend ParameterInCallable class to capture Line and Column offsets. #103

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

Closed
rahlk opened this issue Feb 3, 2025 · 0 comments · Fixed by #122
Closed

Extend ParameterInCallable class to capture Line and Column offsets. #103

rahlk opened this issue Feb 3, 2025 · 0 comments · Fixed by #122
Assignees

Comments

@rahlk
Copy link
Collaborator

rahlk commented Feb 3, 2025

Is your feature request related to a problem? Please describe

Need to capture source code position information (line/column) for parameters in method declarations to enable precise source code navigation and analysis.

Describe the solution you'd like

Add position tracking fields to ParameterInCallable class:

  • startLine: Starting line number
  • endLine: Ending line number
  • startCol: Starting column number
  • endCol: Ending column number

Current implementation:

@Data
public class ParameterInCallable {
    private String type;
    private String name;
    private List<String> annotations;
    private List<String> modifiers;
}

Proposed implementation:

@Data
public class ParameterInCallable {
    private String type;
    private String name;
    private List<String> annotations;
    private List<String> modifiers;
    private int startLine;
    private int endLine;
    private int startCol;
    private int endCol;
}

// Usage in parameter processing:
private static ParameterInCallable processParameterDeclaration(Parameter paramDecl) {
    ParameterInCallable parameter = new ParameterInCallable();
    
    paramDecl.getBegin().ifPresent(position -> {
        parameter.setStartLine(position.line);
        parameter.setStartCol(position.column);
    });

    paramDecl.getEnd().ifPresent(position -> {
        parameter.setEndLine(position.line);
        parameter.setEndCol(position.column);
    });
    
    // ... rest of processing
    return parameter;
}

Describe alternatives you've considered

  1. Store positions as a separate object/map
  2. Track only line numbers without columns
  3. Track only start positions without end positions

Direct field storage in ParameterInCallable provides the clearest and most maintainable solution that can be consumed by CLDK downstream.

Additional context

Implementation requires minor changes:

  1. Add position fields to ParameterInCallable class
  2. Update processParameterDeclaration to populate positions from JavaParser Position objects
  3. Update related tests
@rahlk rahlk self-assigned this Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant