/**
  * Compile and then run sourcecode
  *
  * @param   string source
  * @return  xp.compiler.types.Types
  */
 protected function compile($source)
 {
     $decl = 'class FixtureGenericsIntegrationTest·%d { public void fixture() { %s }}';
     $emitter = new V54Emitter();
     $task = new CompilationTask(new StringSource(sprintf($decl, $this->counter++, $source), self::$syntax, $this->name), new NullDiagnosticListener(), new FileManager(), $emitter);
     return $task->run();
 }
 /**
  * Compile and then run sourcecode
  *
  * @param   string source
  * @return  lang.Runnable
  */
 protected function compile($source)
 {
     $decl = '
 import integrationtests.ArrayExtensions;
 
 class FixturePrimitiveExtensionMethodsIntegrationTest·%d implements Runnable {
   public var run() {
     %s
   }
 }';
     $emitter = new V54Emitter();
     $task = new CompilationTask(new StringSource(sprintf($decl, $this->counter++, $source), self::$syntax, $this->name), new NullDiagnosticListener(), newinstance(FileManager::class, [$this->getClass()->getClassLoader()], '{
     protected $cl;
     
     public function __construct($cl) {
       $this->cl= $cl;
     }
     
     public function findClass($qualified) {
       return new FileSource($this->cl->getResourceAsStream("net/xp_lang/tests/integration/src/".strtr($qualified, ".", "/").".xp"));
     }
     
     public function write($r, File $target) {
       // DEBUG $r->writeTo(Console::$out->getStream());
       $r->executeWith(array());   // Defines the class
     }
   }'), $emitter);
     $type = $task->run();
     return XPClass::forName($type->name())->newInstance();
 }
 /**
  * Compile source
  *
  * @param   string resource
  * @return  xp.compiler.types.Types
  * @throws  xp.compiler.CompilationException
  */
 protected function compileSource($resource)
 {
     $task = new CompilationTask(new FileSource($this->getClass()->getPackage()->getPackage('src')->getResourceAsStream($resource)), new NullDiagnosticListener(), $this->files, $this->emitter);
     return $task->run();
 }