Refactor operator resolution

Open
#2,453 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
compilers

Research direction

Start with the Visitor entry point and its visitBinaryOperator method, then compare the existing function-resolution path referenced by the issue. Determine where operator resolution should occur and how it should be encapsulated. Done means the operator lookup no longer lives directly in Visitor and the resolution timing decision is reflected consistently.

Written by the indexing model from the issue text.

Description

fhirpath refactoring

Encapsulate operator resolution in the manner similar to function resolution.
Decide when do perform the operator resolution (maybe should be at execution time same as for functions)
or maybe the functions should be resolved at parse time as well.

See: Visitor:

  // TODO: encapsulate in operator resolver
  // Decide when do perform the operator resolution (maybe should be at execution time same as for functions)
  // or maybe the functions should be resolved at parse time as well.
  private static final Map<String, BinaryOperator> BINARY_OPERATORS = MethodDefinedOperator.mapOf(
      CollectionOperations.class);

  @Nonnull
  private FhirPath visitBinaryOperator(
      @Nullable final ParseTree leftContext,
      @Nullable final ParseTree rightContext, @Nullable final String operatorName) {
    requireNonNull(operatorName);
    return new EvalOperator(new Visitor().visit(leftContext),
        new Visitor().visit(rightContext),
        Optional.ofNullable(BINARY_OPERATORS.get(operatorName))
            .orElseGet(() -> BinaryOperatorType.fromSymbol(operatorName).getInstance()));
Dominant language
Java
Stars
134
Forks
24
Avg merge
1d 15h
Merged PRs (30d)
8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aehrc/pathling

All issues in aehrc/pathling

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.