Dotty Documentation

0.5.0-bin-SNAPSHOT

class RemoveUnnecessaryNullChecks
extends Object with Optimisation

Eliminated null checks based on the following observations:

  • (this) cannot be null
  • (new C) cannot be null
  • literal is either null itself or non null
  • fallsback to tpe.isNotNull, which will eventually be true for non nullable types.
  • in (a.call; a == null), the first call throws a NPE if a is null; the test can be removed.

[-] Constructors

RemoveUnnecessaryNullChecks ( )

[-] Members

[+] val checkGood : HashMap [ Symbol, Set [ Symbol ] ]
[+] val initializedVals : HashSet [ Symbol ]
[+] def clear ( ) : Unit

Clears all the state of this optimisation, to be run last.

[+] def isGood ( t: Symbol ) ( implicit ctx: Context ) : Boolean
[+] def transformer ( implicit ctx: Context ) : Tree => Tree

Does the actual Tree => Tree transformation.

[+] def visitor ( implicit ctx: Context ) : Tree => Unit

Gathers information on trees (using mutation), to be run first.