Class SymbolResolution
- All Implemented Interfaces:
BiFunction<Workspace,
CompilerFlags, CompilationPhaseResult>
MULTI THREADED Now try and check that all symbols used have a type. THIS IS MAJOR MILESTONE! Create expression symbols in here; so we can pass the type base and also enable type checking. Do some more basic semantic checks in here before developing an IR.
Doing too much focus on the type resolution only we need to call this many times when there a circular type loops. The main complexity in here is building the return types for expressions and resolving types for classes and specific methods. So quite a bit of the semantic checking can go on in here. As always fail as early as possible in the phases. But process that phase to the end. Note that CallId is particularly complex to deal with; all the ways to handle TextForSomething() because it could be.
A. new instance of class TextForSomething i.e. new TextForSomething() - then we have to check it has a constructor with those arguments. B. new instance of a template type that has not had parameters supplied like item := List() - so can we infer its type from the variable assigned to? C. new instance of a template type that has had parameters supplied like item := List(23) - so we can infer from '23' this is a List of integer D. Just a normal method call - so find the method and check the parameters match. E. call to a Function with a number of parameters. F. call to a variable (C# delegate) that points to a function - with a number of parameters.
And probably more by the time we've finished. This will create new inferred parameterised types as it processes instruction blocks. This is why return types from expressions are essential, only if you just have the return type 'in time' can we work out what the generic type is going to be parameterised with. As the next statements and expressions then may use part of that new object via expressions we have to define then 'just a head' of when they are needed.
-
Field Summary
Fields inherited from class org.ek9lang.compiler.CompilerPhase
compilableProgramAccess, listener, reporter
-
Constructor Summary
ConstructorDescriptionSymbolResolution
(boolean multiThread, SharedThreadContext<CompilableProgram> compilableProgramAccess, Consumer<CompilationEvent> listener, CompilerReporter reporter) Create new instance to finally resolve all symbols, even inferred ones. -
Method Summary
Modifier and TypeMethodDescriptionboolean
doApply
(Workspace workspace, CompilerFlags compilerFlags) Do the compilation phase.Methods inherited from class org.ek9lang.compiler.CompilerPhase
apply
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
-
Constructor Details
-
Method Details
-
doApply
Description copied from class:CompilerPhase
Do the compilation phase.- Specified by:
doApply
in classCompilerPhase
-