Consider the following program:
function main(...arguments)
var text
if random() % 2 == 0
text = 'even'
print(text)
In the example shown above, text remains uninitialized when random() returns an odd number. Although this is not a problem for this simple example, but it definitely could cause bugs. Therefore, the compiler should report such errors.
Such errors can be found during static analysis in the resolution phase. The zen_Symbol_t structure can be extended to include flags. A flag which indicates the initialization status of a local variable can be used to detect the errors at zen_SymbolResolutionListener_onExitFunctionDeclaration().
Consider the following program:
In the example shown above, text remains uninitialized when random() returns an odd number. Although this is not a problem for this simple example, but it definitely could cause bugs. Therefore, the compiler should report such errors.
Such errors can be found during static analysis in the resolution phase. The
zen_Symbol_tstructure can be extended to include flags. A flag which indicates the initialization status of a local variable can be used to detect the errors atzen_SymbolResolutionListener_onExitFunctionDeclaration().