Class IsExtractableLiteral

java.lang.Object
org.ek9lang.compiler.support.literals.IsExtractableLiteral
All Implemented Interfaces:
Predicate<ISymbol>

public final class IsExtractableLiteral extends Object implements Predicate<ISymbol>
Whether a symbol is a literal value that may be lifted into a module constant - the symbol-side companion to LiteralTypeNameOf (the parse-context side). True iff the symbol is itself a literal (ISymbol.isFromLiteral() - which distinguishes a literal from a variable, a parameter, or a reference to an already-named constant) AND its type is one of the Ek9LiteralTypes.LITERAL_TYPE_NAMES; false for a null symbol.

A consumer that has resolved the symbol under a cursor (via the shared LocationResolver) can ask this directly to decide whether "Extract Constant" applies - no parse-tree walk needed. An interpolated backtick string resolves to an expression symbol (not isFromLiteral), so it is correctly excluded; a plain backtick or double-quoted string is a literal and qualifies.

  • Constructor Details

    • IsExtractableLiteral

      public IsExtractableLiteral()
  • Method Details