diff options
author | Björn Gustavsson <[email protected]> | 2017-09-09 05:35:26 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-09-11 12:38:59 +0200 |
commit | 3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe (patch) | |
tree | 9a778d33aef49030fd502c66366c906a28a7f3f8 /erts/emulator/utils | |
parent | e15db73b196b1a38f5ce18684739e2b5dd8bb9b2 (diff) | |
download | otp-3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe.tar.gz otp-3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe.tar.bz2 otp-3a7bddaae1b1d3c499f0c03f65a6986ad3bdeefe.zip |
Check the right side of a transformation better
The right side of a transformation must be either a single call
to a transformation function OR a list of instructions. Mixing
them like this is not supported:
some_instruction A B C => gen_something(A) | other B C
Unfortunately, beam_makeops would silenty ignore anything after the
function call, basically handling it in the same way as:
some_instruction A B C => gen_something(A)
Add a sanity check to reject such mixed right-hand sides.
Diffstat (limited to 'erts/emulator/utils')
-rwxr-xr-x | erts/emulator/utils/beam_makeops | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops index 38754e67a1..e55d3eadb5 100755 --- a/erts/emulator/utils/beam_makeops +++ b/erts/emulator/utils/beam_makeops @@ -1720,8 +1720,11 @@ sub parse_transformation { # my @to; - if ($to =~ /^(\w+)\((.*?)\)/) { - my($name, $arglist) = ($1, $2); + if ($to =~ /^(\w+)\((.*?)\)(.*)/) { + my($name, $arglist, $garbage) = ($1, $2, $3); + if ($garbage =~ /\S/) { + error("garbage after call to '$name()'"); + } @to = (compile_transform_function($name, split(/\s*,\s*/, $arglist))); } else { @to = split(/\s*\|\s*/, $to); |