What about simply wrapping it with `if ($this->onCompile)`?