/** * Wrapper around verify * * @param xp.compiler.ast.StaticMethodCallNode call * @param xp.compiler.types.TypeName parent * @return var */ protected function verify(StaticMethodCallNode $call, $parent = null) { $scope = new TypeDeclarationScope(); $scope->declarations[0] = new ClassNode(MODIFIER_PUBLIC, null, new TypeName('Fixture'), $parent ?: new TypeName('lang.Object'), null, [new MethodNode(['name' => 'forName', 'modifiers' => MODIFIER_STATIC | MODIFIER_PUBLIC]), new MethodNode(['name' => 'getInstance', 'modifiers' => MODIFIER_STATIC | MODIFIER_PROTECTED]), new MethodNode(['name' => 'asIntern', 'modifiers' => MODIFIER_STATIC | MODIFIER_PRIVATE])]); $scope->addResolved('parent', $ptr = $scope->resolveType($scope->declarations[0]->parent)); $scope->addResolved('self', new TypeDeclaration(new ParseTree(null, [], $scope->declarations[0]), $ptr)); return $this->fixture->verify($call, $scope); }
/** * Wrapper around verify * * @param xp.compiler.ast.MethodCallNode call * @param xp.compiler.types.TypeName parent * @return var */ private function verify(MethodCallNode $call, $parent = null) { $scope = new TypeDeclarationScope(); $scope->declarations[0] = new ClassNode(MODIFIER_PUBLIC, null, new TypeName('Fixture'), $parent ?: new TypeName('lang.Object'), null, [new MethodNode(['name' => 'hashCode', 'modifiers' => MODIFIER_PUBLIC]), new MethodNode(['name' => 'asIntern', 'modifiers' => MODIFIER_PROTECTED]), new MethodNode(['name' => 'delegate', 'modifiers' => MODIFIER_PRIVATE])]); $scope->addResolved('parent', $ptr = $scope->resolveType($scope->declarations[0]->parent)); $scope->addResolved('self', new TypeDeclaration(new ParseTree(null, [], $scope->declarations[0]), $ptr)); $scope->setType(new VariableNode('this'), new TypeName('Fixture')); return $this->fixture->verify($call, $scope); }