mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-25 12:02:59 +00:00
d515af0ae6
This allows a little bit more of abstraction: we can store other data in the tree, without having to store it in a specific node (e.g. the variables map, which is still unused). It also adds a few typehints, and specializes the return value of eval'ing the AST: previously, it was the one of evalNode, which wasn't guaranteed to be an AFPData. Now we have this guarantee. Last but not least, we can now measure runtime metrics for evalTree, which doesn't recurse. Bonus: fix a check in the old parser, which used the wrong variable when reporting outofbounds errors. Change-Id: Iff806793b1d968e9bb6220f1459f3d0ac587c7da
8 lines
253 B
Perl
8 lines
253 B
Perl
test_array := [ [1, 2], [3, 4], 'useless' ];
|
|
|
|
test_array[1] := 42;
|
|
test_array[ if true then 2 else 0 end] := 'foo';
|
|
test_array[] := 17;
|
|
|
|
test_array[0][0] == 1 & test_array[0][1] == 2 & test_array[1] == 42 & test_array[2] === 'foo' & test_array[3] == 17
|