public function createReferenceToSelf(TES5GlobalScope $globalScope)
 {
     //todo perhaps move tes5scriptAsVariable to a new factory
     return new TES5SelfReference(new TES5ScriptAsVariable($globalScope->getScriptHeader()));
 }
 /**
  * Extracts implicit reference from calls.
  * Returns a reference from calls like:
  * Enable
  * Disable
  * Activate
  * GetInFaction whatsoever
  * @param TES5GlobalScope $globalScope
  * @param TES5MultipleScriptsScope $multipleScriptsScope
  * @param TES5LocalScope $localScope
  * @return TES5Referencer
  * @throws \Ormin\OBSLexicalParser\TES5\Exception\ConversionException
  */
 private function extractImplicitReference(TES5GlobalScope $globalScope, TES5MultipleScriptsScope $multipleScriptsScope, TES5LocalScope $localScope)
 {
     switch ($globalScope->getScriptHeader()->getBasicScriptType()) {
         case TES5BasicType::T_OBJECTREFERENCE():
             return $this->referenceFactory->createReferenceToSelf($globalScope);
         case TES5BasicType::T_ACTIVEMAGICEFFECT():
             $self = $this->referenceFactory->createReferenceToSelf($globalScope);
             return $this->createObjectCall($self, "GetTargetActor", $multipleScriptsScope);
         case TES5BasicType::T_QUEST():
             //todo - this should not be done like this
             //we should actually not try to extract the implicit reference on the non-reference oblivion functions like "stopQuest"
             //think of this line as a hacky way to just get code forward.
             return $this->referenceFactory->createReferenceToSelf($globalScope);
             /**
              * TIF Fragments
              */
         /**
          * TIF Fragments
          */
         case TES5BasicType::T_TOPICINFO():
             return $this->createReadReference('akSpeakerRef', $globalScope, $multipleScriptsScope, $localScope);
         default:
             throw new ConversionException("Cannot extract implicit reference - unknown basic script type.");
     }
 }