Class SymbolMatcher

java.lang.Object
org.ek9lang.compiler.support.SymbolMatcher
All Implemented Interfaces:
Serializable

public class SymbolMatcher extends Object implements Serializable
Given some search criteria and a List of Symbols, this class will find the best match. The main reason for this is to avoid method name mangling and incorporate coercion, and interface/super type matches.
See Also:
  • Constructor Details

    • SymbolMatcher

      public SymbolMatcher()
  • Method Details

    • addMatchesToResult

      public void addMatchesToResult(MethodSymbolSearchResult result, SymbolSearch criteria, List<MethodSymbol> methodSymbols)
      Match the search criteria against one or more symbol methods. We use a weighting algorithm to try and find the best match where there are methods of the same name.
    • getWeightOfParameterMatch

      public double getWeightOfParameterMatch(List<ISymbol> fromSymbols, List<ISymbol> toSymbols)
      Calculates the weight of matching these two lists of parameters. This is useful for calculating matches to overloaded methods and coercions. But if the symbols do not have types then it's an immediate failure to match.
    • getWeightOfMatch

      public double getWeightOfMatch(Optional<ISymbol> fromSymbol, Optional<ISymbol> toSymbol)
      Calculates te weight of matching two symbols, which may or may not be present.