Skip to content

Commit 5580efa

Browse files
committed
WIP commit
1 parent 8b6348b commit 5580efa

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/Core/JVM/FlexibleMethod.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33

44
class FlexibleMethod
55
{
6+
/**
7+
* @var \ReflectionMethod $method
8+
*/
69
private $method;
710

8-
public function __construct(\ReflectionMethod $method)
11+
private $object;
12+
13+
public function __construct($object, \ReflectionMethod $method)
914
{
15+
$this->object = $object;
1016
$this->method = $method;
1117
}
18+
19+
public function __invoke(...$arguments)
20+
{
21+
return $this->method->invokeArgs($this->object, $arguments);
22+
}
1223
}

src/Core/JVM/Invoker/Invokable.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ function ($argument) {
124124
/**
125125
* @var FlexibleMethod $method
126126
*/
127-
// TODO: will implement invocation for flexible method
128-
return $method->invoke();
127+
return $method(...$arguments);
129128
}
130129

131130
$codeAttribute = $getCodeAttribute($method->getAttributes());

src/Utilities/SuperClassResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function resolveMethod($methodName, JavaClass $class)
3535
}
3636
$prependItems[$resolvedMethodName] = array_merge(
3737
$prependItems[$resolvedMethodName],
38-
[new FlexibleMethod($callee)]
38+
[new FlexibleMethod($class->getSuperClass(), $callee)]
3939
);
4040
}
4141
return array_merge($prependItems, $this->classes);

0 commit comments

Comments
 (0)