/** * Finds the member declaration * * @param lang.mirrors.Source $declaredIn * @param string $kind * @param string $name * @return [:var] */ private function memberDeclaration($declaredIn, $kind, $name) { if ($declaredIn->typeModifiers()->isNative()) { return null; } else { $declaration = $declaredIn->codeUnit()->declaration(); if (isset($declaration[$kind][$name])) { return $declaration[$kind][$name]; } foreach ($declaredIn->allTraits() as $trait) { $declaration = $trait->codeUnit()->declaration(); if (isset($declaration[$kind][$name])) { return $declaration[$kind][$name]; } } throw new IllegalStateException('The ' . $kind . ' declaration of ' . $declaredIn->name . '::' . $name . ' could not be located'); } }
/** * Resolve this value * * @param lang.mirrors.Source $source * @return var */ public function resolve($source) { return new XPClass($source->resolve($this->name)->name); }
/** * Resolve this value * * @param lang.mirrors.Source $source * @return var */ public function resolve($source) { return $source->resolve($this->type)->newInstance(array_map(function ($arg) use($source) { return $arg->resolve($source); }, $this->arguments)); }