Skip to content

04 PhIP ReparseAfterSourceEditing Cleanup

Marcus Denker edited this page May 21, 2021 · 3 revisions

PhIP04 Compiler: simply exception handling and remove the need for ReparseAfterSourceEditing

The compiler right now tries to handle missing variable definitions "on the fly" as part of the OCUndeclaredVariableWarning exception.

This leads to lots of complex code (see ReparseAfterSourceEditing) to handle the case when the source gets edited during the handling of the exception.

If we step back, it seems we do not need this complexity at all.

The idea to handle variable definition during the exception was just done as there was no way to handle it later. But with our current tooling, we already show icons in the text editor when an undeclared variable is seen (which can happen e.g. when compiling in non-interactive mode).

This PhiP proposes to do the following:

  • improve the icon in the editor to have a good "repair action” for Undeclared Variables
  • remove the current exception handling code and just compile Undeclared Variables even in interactive mode.

This change will radically simplify the exception handling code in the compiler. In addition, it improves the interactive use for the user as now the programmer can decide when to fix a variable which is not yet defined, instead of being forced to do so when accepting a method.

Related PHiPs