File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \Type ;
56use PHPJava \Utilities \BinaryTool ;
7+ use PHPJava \Utilities \Extractor ;
68
79final class _castore implements OperationInterface
810{
@@ -11,6 +13,19 @@ final class _castore implements OperationInterface
1113
1214 public function execute (): void
1315 {
14- throw new NotImplementedException (__CLASS__ );
16+ $ value = Extractor::realValue ($ this ->popFromOperandStack ());
17+ $ index = Extractor::realValue ($ this ->popFromOperandStack ());
18+
19+ /**
20+ * @var Type $arrayref
21+ */
22+ $ arrayref = $ this ->popFromOperandStack ();
23+
24+ // The value is a ref.
25+ $ arrayref [$ index ] = chr ($ value );
26+
27+ $ this ->pushToOperandStack (
28+ $ arrayref
29+ );
1530 }
1631}
Original file line number Diff line number Diff line change @@ -14,19 +14,19 @@ final class _iastore implements OperationInterface
1414
1515 public function execute (): void
1616 {
17- $ data = Extractor::realValue ($ this ->popFromOperandStack ());
18- $ arrayref = Extractor::realValue ($ this ->popFromOperandStack ());
17+ $ value = Extractor::realValue ($ this ->popFromOperandStack ());
18+ $ index = Extractor::realValue ($ this ->popFromOperandStack ());
1919
2020 /**
21- * @var Type $value
21+ * @var Type $arrayref
2222 */
23- $ value = $ this ->popFromOperandStack ();
23+ $ arrayref = $ this ->popFromOperandStack ();
2424
2525 // The value is a ref.
26- $ value [ $ arrayref ] = $ data ;
26+ $ arrayref [ $ index ] = $ value ;
2727
2828 $ this ->pushToOperandStack (
29- $ value
29+ $ arrayref
3030 );
3131 }
3232}
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ public function getType($default = null): ?string
2525 ) ?? $ default ;
2626 }
2727
28+ public function __toString ()
29+ {
30+ return implode ($ this ->data );
31+ }
32+
2833 public function toArray ()
2934 {
3035 return $ this ->data ;
You can’t perform that action at this time.
0 commit comments