private function constructorFunctionInstantiate(InstantiateCommand $x)
 {
     $targetClass = $x->getTargetClass();
     $functionName = $this->constructorFunctions->get($targetClass);
     if (!is_null($functionName)) {
         return $functionName;
     }
     //echo '[constructor ' . $targetClass->getFullName() . ']';
     $seedName = $this->clientOracle->getSeedName($targetClass);
     assert(!is_null($seedName));
     $functionName = $this->clientOracle->createUnusedIdent($seedName);
     $this->constructorFunctions->put($targetClass, $functionName);
     $setters = $x->getSetters();
     $idents = array_new(count($setters) + 1, '');
     for ($i = 0, $j = count($idents); $i < $j; $i++) {
         $idents[$i] = '_' . $i;
     }
     // function foo(_0, _1, _2) {_0.a = _1; _0.b=_2; return _0}
     $this->_function();
     $this->push($functionName);
     $this->lparen();
     for ($i = 0, $j = count($idents); $i < $j; $i++) {
         $this->push($idents[$i]);
         if ($i < $j - 1) {
             $this->comma();
         }
     }
     $this->rparen();
     $this->lbrace();
     $this->newlineOpt();
     for ($i = 1, $j = count($idents); $i < $j; $i++) {
         $setter = $setters[$i - 1];
         $fieldIdent = $this->clientOracle->getFieldId($setter->getFieldDeclClass(), $setter->getField());
         // _0.foo = bar;
         $this->spaceOpt();
         $this->push($idents[0]);
         $this->dot();
         $this->push($fieldIdent);
         $this->eq();
         $this->push($idents[$i]);
         $this->semi();
     }
     $this->spaceOpt();
     $this->_return();
     $this->push($idents[0]);
     $this->rbrace();
     $this->newlineOpt();
     $this->flush($x);
     return $functionName;
 }
 private function getMethodIdByClass($className, $methodName, array $args)
 {
     $jsniArgTypes = array_new(count($args), null);
     for ($i = 0, $c = count($args); $i < $c; $i++) {
         $jsniArgTypes[$i] = $this->jsniName($args[$i]);
     }
     return $this->getMethodIdByClassName($className, $methodName, $jsniArgTypes);
 }