Package org.ek9lang.compiler.phase2
Class ProcessVariableDeclarationOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.phase2.ProcessVariableDeclarationOrError
- All Implemented Interfaces:
Consumer<EK9Parser.VariableDeclarationContext>
final class ProcessVariableDeclarationOrError
extends RuleSupport
implements Consumer<EK9Parser.VariableDeclarationContext>
Checks for inferred declarations of variables in various contexts.
If possible it will attempt to workout what the type is, if it cannot it will emit an error.
This is designed to aid in simple property declarations as much as possible, but property initialisation cannot
really trigger full expression processing - that is a potential long and circular trail - that must be done in phase
three. The main idea is to ensure that before phase three starts ALL properties on aggregates are 'typed'.
This aspect is essential for the phase three expression processing (as that requires types are known on interfaces
and aggregate properties to function correctly).
Note that it is possible to 'force' the EK9 developer to declare properties in the more long hand way as shown below.
shorthand <- 1 longhand as Integer: 1
-
Field Summary
Fields inherited from class org.ek9lang.compiler.common.RuleSupport
errorListener, symbolsAndScopes
-
Constructor Summary
ConstructorDescriptionProcessVariableDeclarationOrError
(SymbolsAndScopes symbolsAndScopes, SymbolFactory symbolFactory, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
ProcessVariableDeclarationOrError
ProcessVariableDeclarationOrError(SymbolsAndScopes symbolsAndScopes, SymbolFactory symbolFactory, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
accept
in interfaceConsumer<EK9Parser.VariableDeclarationContext>
-