Class ProcessSyntheticReturn

java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.phase1.ProcessSyntheticReturn
All Implemented Interfaces:
Consumer<IMayReturnSymbol>

class ProcessSyntheticReturn extends RuleSupport implements Consumer<IMayReturnSymbol>
Constructs like methods and functions may or may not always retun a value. So when defining these in EK9 the developer can decide not to return any value. However within the compiler when resolving expressions and calls, it is important to fill in the 'void' definition for the returning type. That is what this component does. In the case where no return value is defined by the EK9 developer the compiler creates a dummy '_rtn' variable and gives it the type Void. So when the compiler comes to check expression use it can see that a function/method does not actually return anything and therefore it can emit errors (in the case where the EK9 developer is incorrectly expecting some form of value).