Class CompilerFlags

java.lang.Object
org.ek9lang.compiler.CompilerFlags
Direct Known Subclasses:
Ek9CompilerConfig

public class CompilerFlags extends Object
Used to drive how the compiler operates. As error message details, future will be to add debug output files for 'edb' the Ek9 Debugger. We may even have things like target or flags to drive different type out output generation. Maybe one day - but right now it's just how much help do you want on errors. I'm expecting that when we run 'ek9' or whatever we call the compiler there will be flags like '-Cg/-cg' for debug and the like. These options below will also have flags like -Xhelp:key(,key)* -Xhelp:+method,-type,+variable - would be a good way to enable methodSuggestionRequired, disable typeFunctionConstructorSuggestionRequired and enable variableSuggestionRequired. Also -Xlint:key(,key)* for different levels of warning - which we can drive from here when we want to control warnings. Some of these flags exist in CommandLineDetails, I may move some or all of that configuration into this class. But those options are more about 'what' to do with the compiler. These flags are more like - how you want the compiler to behave when issuing errors or suggestions.
  • Constructor Details

    • CompilerFlags

      public CompilerFlags()
    • CompilerFlags

      public CompilerFlags(CompilationPhase compileToPhase)
    • CompilerFlags

      public CompilerFlags(CompilationPhase compileToPhase, boolean verbose)
    • CompilerFlags

      public CompilerFlags(boolean verbose)
  • Method Details

    • isSuggestionRequired

      public boolean isSuggestionRequired()
    • setSuggestionRequired

      public void setSuggestionRequired(boolean suggestionRequired)
    • getNumberOfSuggestions

      public int getNumberOfSuggestions()
    • setNumberOfSuggestions

      public void setNumberOfSuggestions(int numberOfSuggestions)
      Configure the number of suggestions for interactive help on errors.
    • getCompileToPhase

      public CompilationPhase getCompileToPhase()
    • setCompileToPhase

      public void setCompileToPhase(CompilationPhase compileToPhase)
      Only compile to a specific phase of the overall compilation process.
    • isDebuggingInstrumentation

      public boolean isDebuggingInstrumentation()
    • setDebuggingInstrumentation

      public void setDebuggingInstrumentation(boolean debuggingInstrumentation)
    • isDevBuild

      public boolean isDevBuild()
    • setDevBuild

      public void setDevBuild(boolean devBuild)
    • isCheckCompilationOnly

      public boolean isCheckCompilationOnly()
    • setCheckCompilationOnly

      public void setCheckCompilationOnly(boolean checkCompilationOnly)
      Only run a check compilation. This means run upto IR Analysis phase only.
    • isVerbose

      public boolean isVerbose()
    • setVerbose

      public void setVerbose(boolean verbose)
    • setTargetArchitecture

      public void setTargetArchitecture(TargetArchitecture targetArchitecture)
    • getTargetArchitecture

      public TargetArchitecture getTargetArchitecture()
    • setOptimizationLevel

      public void setOptimizationLevel(OptimizationLevel optimizationLevel)
    • getOptimizationLevel

      public OptimizationLevel getOptimizationLevel()
    • getErrorLevel

      public int getErrorLevel()
      Get the error verbosity level (0-3).
    • setErrorLevel

      public void setErrorLevel(int errorLevel)
      Set the error verbosity level. Cumulative: each level includes features from lower levels.
      Parameters:
      errorLevel - 0=minimal, 1=visual, 2=visual+fuzzy, 3=visual+fuzzy+verbose
    • isVisualErrorsEnabled

      public boolean isVisualErrorsEnabled()
      Check if visual error formatting is enabled (level >= 1).
    • isFuzzySuggestionsEnabled

      public boolean isFuzzySuggestionsEnabled()
      Check if fuzzy matching suggestions are enabled (level >= 2).
    • isVerboseErrorsEnabled

      public boolean isVerboseErrorsEnabled()
      Check if verbose error explanations are enabled (level >= 3).
    • isCoverageEnabled

      public boolean isCoverageEnabled()
      Check if coverage instrumentation is enabled.
    • setCoverageEnabled

      public CompilerFlags setCoverageEnabled(boolean coverageEnabled)
      Enable or disable coverage instrumentation. When enabled, coverage probes are inserted during IR generation.
      Parameters:
      coverageEnabled - true to enable coverage, false to disable
      Returns:
      this for fluent chaining
    • getCoverageMode

      public CoverageMode getCoverageMode()
      Get the coverage tracking mode.
    • setCoverageMode

      public CompilerFlags setCoverageMode(CoverageMode coverageMode)
      Set the coverage tracking mode.
      Parameters:
      coverageMode - SET (boolean), COUNT (integer), or ATOMIC (thread-safe)
      Returns:
      this for fluent chaining