Skip to content

Validity Checker

martin-henz edited this page Mar 2, 2020 · 7 revisions

Definition: Simple declarations are:

  • function declarations and
  • let and const declarations whose right hand side have no function calls.

The purpose of the validity checker is to:

  • Reject any return statements outside of function definitions and declarations.
  • Reject any return statements inside of while and for loops (that are not in any function definitions and declarations in that loop).
  • Reject any assignments to the loop control variable in for loops.
  • Reject any assignments to names declared with const or function.
  • Annotate any function declaration in a statement sequence as typable, if there are only simple declarations before it in the sequence.
  • Annotate any const or let declaration in a statement sequence as typable, if its name does not occur in its own right-hand side or in any statement before it in the sequence.

(here goes a more detailed specification: input:..., output:...)