Interface Directive
- All Known Implementing Classes:
ComplexityDirective
,ErrorDirective
,GenusDirective
,ImplementsDirective
,NotResolvedDirective
,ResolutionDirective
,ResolvedDirective
In general while you are looking to create code that compiles, during the development of the compiler we're actually looking to detect (accurately) code that does not compile. These directive embedded in EK9 source files make that testing much easier.
This is especially true when a defect or missing rule in found in the EK9 compiler for some code that should actually fail to compile. That example code can be used as an example and the appropriate directive used to check for the error (clearly initially it won't trigger - dues to the bug). But when the existing rule is corrected or a new rule is added it acts as a regression test.
The EK9 compiler code base has hundreds (and in the end probably thousands) of example source files, some of which should compile and others which must notcompile.
@Resolved
: SYMBOL_DEFINITION: TYPE: "Person"@Resolved
: SYMBOL_DEFINITION: FUNCTION: "someThingElse"@Resolved
: EXPLICIT_TYPE_SYMBOL_DEFINITION: TEMPLATE_TYPE: "List"@Resolved
: EXPLICIT_TYPE_SYMBOL_DEFINITION: TYPE: "List of (Integer)"@NotResolved
: EXPLICIT_TYPE_SYMBOL_DEFINITION: TYPE: "List of (Date)"@Implements
: SYMBOL_DEFINITION: TYPE: "CType": "SomeGenericType of (Integer, String)"@Genus
: FULL_RESOLUTION: TYPE: "ServiceApplication": "SERVICE_APPLICATION"
Used in specific cases where we make changes to the complexity calculator With this mechanism you can ensure that complexity calculations are working
@Complexity
: PRE_IR_CHECKS: FUNCTION: "SomeFunction": 12@Complexity
: PRE_IR_CHECKS: FUNCTION: "testNoArguments": 2@Error
: PRE_IR_CHECKS: EXCESSIVE_COMPLEXITY
-
Method Summary
Modifier and TypeMethodDescriptionint
Which line number does this directive apply to.Provide a token from the source, by default if not possible supply synthetic.boolean
isForPhase
(CompilationPhase phase) Is it for the particular compiler phase.type()
What s the type of the directive.
-
Method Details
-
type
DirectiveType type()What s the type of the directive. -
isForPhase
Is it for the particular compiler phase. -
getAppliesToLineNumber
int getAppliesToLineNumber()Which line number does this directive apply to. -
getDirectiveToken
IToken getDirectiveToken()Provide a token from the source, by default if not possible supply synthetic.
-