Package org.ek9lang.compiler.directives


package org.ek9lang.compiler.directives

The directives are really aimed at helping the creation of the EK9 language, but they maybe very useful in the early stages of adoption of ek9 (should there be any). Because they enable an ek9 developer to send the ek9 compiler developers (me) an example of code that is broken.

The example below shows that the type for 'i' could not be worked out by the compiler and due to that later on a second error is triggered. The 'at' Error is this directive.

The 'FULL_RESOLUTION' is the 'phase' of compilation this error was detected in, and the 'UNABLE_TO_DETERMINE_COMMON_TYPE' is the error enumeration from 'ErrorListener.SemanticClassification'.

 #!ek9
 defines module bad.forloops.check
   defines program

     BadForLoopIncompatibleTypes1
       stdout ← Stdout()

       @Error::  FULL_RESOLUTION: UNABLE_TO_DETERMINE_COMMON_TYPE
       for i in 1 ... 'c'
         @Error: FULL_RESOLUTION: TYPE_NOT_RESOLVED
         stdout.println(`Value [${i}]`)
 //EOF
 
  • Class
    Description
    Provides basic interface for the EK9 internal @ type directives.
    Provides the listeners for directive checks.
    Just extracts the compilation phase or throws an illegal argument exception.
    Finds the next line number from where a directive has been used.
    Specification of a directive, all the common details used in a range of directives.
    Just extract the spec from the free format data in the directive.
    Just extracts the symbol category or throws an illegal argument exception.
    Just extracts the symbol name or throws an illegal argument exception.
    To be used in EK9 source code, for things like internal tests or compiler directives, instrumentation, reified type retention etc.
    To be used in EK9 source code to assert that an error will be created.
    Just checks if there are any directives that relate to errors in the parsed module and tallies those up with any errors held for the phase of compilation.
    To be used in EK9 source code to assert that a type can or cannot be resolved.
    Just checks if there are any directives that relate to @Genus in the parsed module and checks the resolution through the symbol and its genus.
    To be used in EK9 source code to assert that a type can or cannot be resolved as extending a type or function.
    Just checks if there are any directives that relate to @Implements in the parsed module and checks the resolution through the symbol and its hierarchy.
    To be used in EK9 source code to assert that a type can or cannot be resolved.
    Just checks if there are any directives that relate to @Resolved in the parsed module and checks the non-resolution.
    To be used in EK9 source code to assert that a type can or cannot be resolved.
    For resolved and notResolved directives.
    To be used in EK9 source code to assert that a type can or cannot be resolved.
    Just checks if there are any directives that relate to @Resolved in the parsed module and checks the resolution.