Skip to content

Commit

Permalink
standardize QAST Op formatting
Browse files Browse the repository at this point in the history
... and update the test to be able to find these ops in the docs.
  • Loading branch information
coke committed Apr 3, 2020
1 parent 1b2b486 commit 789c41e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 1 addition & 3 deletions docs/ops.markdown
Expand Up @@ -2568,9 +2568,7 @@ variable. Same as the `:=` operator in NQP.
# <a id="misc"></a> Miscellaneous Opcodes

## locallifetime
```perl6
QAST::Op.new( :op('locallifetime'), :node($/), QAST::Stmt.new(...))
```
* `QAST::Op.new(:op<locallifetime>, :node($/), QAST::Stmt.new(...))`

Defines when local variables can be considered dead. E.g. the temporary setting
of `$_` on the right side of `~~` uses that.
Expand Down
11 changes: 9 additions & 2 deletions t/docs/opcodes.t
Expand Up @@ -129,8 +129,15 @@ sub find_documented_opcodes() {
}
}
next unless $line ~~ / ^ '* `' .* '(' .* '`' $ /;
$line := nqp::substr($line, 3);
$line := nqp::split("(", $line)[0];
$match := $line ~~ / 'QAST::Op.new' .* ':op<' (.*?) '>' /;
if ?$match {
# Opcode only usable via QAST
$line := ~$match[0];
} else {
# Regular opcode
$line := nqp::substr($line, 3);
$line := nqp::split("(", $line)[0];
}
for @opcode_vms -> $vm {
%documented_ops{$vm}{$line} := 1 ;
}
Expand Down

0 comments on commit 789c41e

Please sign in to comment.