Class CompileTimeKnownText

java.lang.Object
org.ek9lang.compiler.phase5.CompileTimeKnownText

final class CompileTimeKnownText extends Object
Is the value of an expression KNOWN WHEN THE PROGRAM IS COMPILED - that is, made only from text written in the source? Used by UrlTextKnownAtCompileTimeOrError (E08275, decision U3 of docs/architecture/EK9_URL_TYPE_DESIGN.md ยง0).

Known: a literal; a string with interpolations whose every ${...} is known; +, $, ??/?: and a ternary whose parts are all known; a parenthesised known expression; a defines constant; and a LOCAL variable whose declaration and every assignment give it known values (a variable declared unset, text as String?, starts with no value and so adds nothing). Anything else is not known: a parameter, a property, a loop variable, a capture, a call (even one that only returns a literal), a method, a stream, a switch or try expression. So the answer can say "not known" for text that is in fact fixed - never the reverse.

  • Constructor Details

    • CompileTimeKnownText

      CompileTimeKnownText(ParsedModule parsedModule)
  • Method Details

    • isKnown

      boolean isKnown(EK9Parser.ExpressionContext expression, org.antlr.v4.runtime.tree.ParseTree region)
      Is expression, evaluated anywhere within region, made only from source text.