summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-11-29 20:19:20 +0000
committerZefram <zefram@fysh.org>2017-11-29 20:19:20 +0000
commit97b4caa610942fa2caded4f8ec03ac72089cd30e (patch)
treeeb4e355f7bb4909b5db236857b80af270a345a62
parent619bbb9ab0f3cffda05f980b2ebb5bf660ad6962 (diff)
downloadperl-97b4caa610942fa2caded4f8ec03ac72089cd30e.tar.gz
remove useless "break" mechanism
-rw-r--r--ext/Opcode/Opcode.pm4
-rw-r--r--ext/Pod-Functions/Functions_pm.PL2
-rw-r--r--ext/Pod-Functions/t/Functions.t2
-rw-r--r--keywords.c36
-rw-r--r--keywords.h465
-rw-r--r--lib/B/Deparse-core.t3
-rw-r--r--lib/B/Deparse.pm2
-rw-r--r--lib/B/Deparse.t10
-rw-r--r--opcode.h7
-rw-r--r--opnames.h353
-rw-r--r--pod/perldiag.pod9
-rw-r--r--pod/perlfunc.pod30
-rw-r--r--pod/perlsyn.pod13
-rw-r--r--pp_ctl.c23
-rw-r--r--pp_proto.h1
-rwxr-xr-xregen/keywords.pl2
-rw-r--r--regen/opcodes1
-rw-r--r--t/lib/feature/switch40
-rw-r--r--t/op/coreamp.t12
-rw-r--r--t/op/cproto.t3
-rw-r--r--t/op/switch.t33
-rw-r--r--toke.c3
22 files changed, 447 insertions, 607 deletions
diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm
index 01c495d5d6..9ebaa56c91 100644
--- a/ext/Opcode/Opcode.pm
+++ b/ext/Opcode/Opcode.pm
@@ -6,7 +6,7 @@ use strict;
our($VERSION, @ISA, @EXPORT_OK);
-$VERSION = "1.41";
+$VERSION = "1.42";
use Carp;
use Exporter ();
@@ -428,7 +428,7 @@ These are a hotchpotch of opcodes still waiting to be considered
entergiven leavegiven
enterwhen leavewhen
- break continue
+ continue
smartmatch
custom -- where should this go
diff --git a/ext/Pod-Functions/Functions_pm.PL b/ext/Pod-Functions/Functions_pm.PL
index eb8369a470..bd0e3dad80 100644
--- a/ext/Pod-Functions/Functions_pm.PL
+++ b/ext/Pod-Functions/Functions_pm.PL
@@ -207,7 +207,7 @@ L<perlfunc/"Perl Functions by Category"> section.
=cut
-our $VERSION = '1.11';
+our $VERSION = '1.12';
require Exporter;
diff --git a/ext/Pod-Functions/t/Functions.t b/ext/Pod-Functions/t/Functions.t
index 2beccc1ac6..23301142ba 100644
--- a/ext/Pod-Functions/t/Functions.t
+++ b/ext/Pod-Functions/t/Functions.t
@@ -113,7 +113,7 @@ Functions for filehandles, files, or directories:
select, stat, symlink, sysopen, umask, unlink, utime
Keywords related to the control flow of your Perl program:
- __FILE__, __LINE__, __PACKAGE__, __SUB__, break, caller,
+ __FILE__, __LINE__, __PACKAGE__, __SUB__, caller,
continue, die, do, dump, eval, evalbytes, exit, goto,
last, next, redo, return, sub, wantarray
diff --git a/keywords.c b/keywords.c
index e68e9f5f6f..1576d4addf 100644
--- a/keywords.c
+++ b/keywords.c
@@ -950,7 +950,7 @@ Perl_keyword (pTHX_ const char *name, I32 len, bool all_keywords)
goto unknown;
}
- case 5: /* 39 tokens of length 5 */
+ case 5: /* 38 tokens of length 5 */
switch (name[0])
{
case 'B':
@@ -1003,32 +1003,16 @@ Perl_keyword (pTHX_ const char *name, I32 len, bool all_keywords)
}
case 'b':
- switch (name[1])
- {
- case 'l':
- if (name[2] == 'e' &&
- name[3] == 's' &&
- name[4] == 's')
- { /* bless */
- return -KEY_bless;
- }
-
- goto unknown;
-
- case 'r':
- if (name[2] == 'e' &&
- name[3] == 'a' &&
- name[4] == 'k')
- { /* break */
- return (all_keywords || FEATURE_SWITCH_IS_ENABLED ? -KEY_break : 0);
- }
-
- goto unknown;
-
- default:
- goto unknown;
+ if (name[1] == 'l' &&
+ name[2] == 'e' &&
+ name[3] == 's' &&
+ name[4] == 's')
+ { /* bless */
+ return -KEY_bless;
}
+ goto unknown;
+
case 'c':
switch (name[1])
{
@@ -3417,5 +3401,5 @@ unknown:
}
/* Generated from:
- * 1e6a65fdd2e2d8aec28927cb9cbfed6e8a33ba077f0114b420746a04b0df8792 regen/keywords.pl
+ * 50664fad65e719c51bf369702163eb7ade79f997461f928cc20f1e1bcf8369b8 regen/keywords.pl
* ex: set ro: */
diff --git a/keywords.h b/keywords.h
index f82df6abe4..cd4ecb3631 100644
--- a/keywords.h
+++ b/keywords.h
@@ -35,239 +35,238 @@
#define KEY_bind 19
#define KEY_binmode 20
#define KEY_bless 21
-#define KEY_break 22
-#define KEY_caller 23
-#define KEY_chdir 24
-#define KEY_chmod 25
-#define KEY_chomp 26
-#define KEY_chop 27
-#define KEY_chown 28
-#define KEY_chr 29
-#define KEY_chroot 30
-#define KEY_close 31
-#define KEY_closedir 32
-#define KEY_cmp 33
-#define KEY_connect 34
-#define KEY_continue 35
-#define KEY_cos 36
-#define KEY_crypt 37
-#define KEY_dbmclose 38
-#define KEY_dbmopen 39
-#define KEY_defined 40
-#define KEY_delete 41
-#define KEY_die 42
-#define KEY_do 43
-#define KEY_dump 44
-#define KEY_each 45
-#define KEY_else 46
-#define KEY_elsif 47
-#define KEY_endgrent 48
-#define KEY_endhostent 49
-#define KEY_endnetent 50
-#define KEY_endprotoent 51
-#define KEY_endpwent 52
-#define KEY_endservent 53
-#define KEY_eof 54
-#define KEY_eq 55
-#define KEY_eval 56
-#define KEY_evalbytes 57
-#define KEY_exec 58
-#define KEY_exists 59
-#define KEY_exit 60
-#define KEY_exp 61
-#define KEY_fc 62
-#define KEY_fcntl 63
-#define KEY_fileno 64
-#define KEY_flock 65
-#define KEY_for 66
-#define KEY_foreach 67
-#define KEY_fork 68
-#define KEY_format 69
-#define KEY_formline 70
-#define KEY_ge 71
-#define KEY_getc 72
-#define KEY_getgrent 73
-#define KEY_getgrgid 74
-#define KEY_getgrnam 75
-#define KEY_gethostbyaddr 76
-#define KEY_gethostbyname 77
-#define KEY_gethostent 78
-#define KEY_getlogin 79
-#define KEY_getnetbyaddr 80
-#define KEY_getnetbyname 81
-#define KEY_getnetent 82
-#define KEY_getpeername 83
-#define KEY_getpgrp 84
-#define KEY_getppid 85
-#define KEY_getpriority 86
-#define KEY_getprotobyname 87
-#define KEY_getprotobynumber 88
-#define KEY_getprotoent 89
-#define KEY_getpwent 90
-#define KEY_getpwnam 91
-#define KEY_getpwuid 92
-#define KEY_getservbyname 93
-#define KEY_getservbyport 94
-#define KEY_getservent 95
-#define KEY_getsockname 96
-#define KEY_getsockopt 97
-#define KEY_given 98
-#define KEY_glob 99
-#define KEY_gmtime 100
-#define KEY_goto 101
-#define KEY_grep 102
-#define KEY_gt 103
-#define KEY_hex 104
-#define KEY_if 105
-#define KEY_index 106
-#define KEY_int 107
-#define KEY_ioctl 108
-#define KEY_join 109
-#define KEY_keys 110
-#define KEY_kill 111
-#define KEY_last 112
-#define KEY_lc 113
-#define KEY_lcfirst 114
-#define KEY_le 115
-#define KEY_length 116
-#define KEY_link 117
-#define KEY_listen 118
-#define KEY_local 119
-#define KEY_localtime 120
-#define KEY_lock 121
-#define KEY_log 122
-#define KEY_lstat 123
-#define KEY_lt 124
-#define KEY_m 125
-#define KEY_map 126
-#define KEY_mkdir 127
-#define KEY_msgctl 128
-#define KEY_msgget 129
-#define KEY_msgrcv 130
-#define KEY_msgsnd 131
-#define KEY_my 132
-#define KEY_ne 133
-#define KEY_next 134
-#define KEY_no 135
-#define KEY_not 136
-#define KEY_oct 137
-#define KEY_open 138
-#define KEY_opendir 139
-#define KEY_or 140
-#define KEY_ord 141
-#define KEY_our 142
-#define KEY_pack 143
-#define KEY_package 144
-#define KEY_pipe 145
-#define KEY_pop 146
-#define KEY_pos 147
-#define KEY_print 148
-#define KEY_printf 149
-#define KEY_prototype 150
-#define KEY_push 151
-#define KEY_q 152
-#define KEY_qq 153
-#define KEY_qr 154
-#define KEY_quotemeta 155
-#define KEY_qw 156
-#define KEY_qx 157
-#define KEY_rand 158
-#define KEY_read 159
-#define KEY_readdir 160
-#define KEY_readline 161
-#define KEY_readlink 162
-#define KEY_readpipe 163
-#define KEY_recv 164
-#define KEY_redo 165
-#define KEY_ref 166
-#define KEY_rename 167
-#define KEY_require 168
-#define KEY_reset 169
-#define KEY_return 170
-#define KEY_reverse 171
-#define KEY_rewinddir 172
-#define KEY_rindex 173
-#define KEY_rmdir 174
-#define KEY_s 175
-#define KEY_say 176
-#define KEY_scalar 177
-#define KEY_seek 178
-#define KEY_seekdir 179
-#define KEY_select 180
-#define KEY_semctl 181
-#define KEY_semget 182
-#define KEY_semop 183
-#define KEY_send 184
-#define KEY_setgrent 185
-#define KEY_sethostent 186
-#define KEY_setnetent 187
-#define KEY_setpgrp 188
-#define KEY_setpriority 189
-#define KEY_setprotoent 190
-#define KEY_setpwent 191
-#define KEY_setservent 192
-#define KEY_setsockopt 193
-#define KEY_shift 194
-#define KEY_shmctl 195
-#define KEY_shmget 196
-#define KEY_shmread 197
-#define KEY_shmwrite 198
-#define KEY_shutdown 199
-#define KEY_sin 200
-#define KEY_sleep 201
-#define KEY_socket 202
-#define KEY_socketpair 203
-#define KEY_sort 204
-#define KEY_splice 205
-#define KEY_split 206
-#define KEY_sprintf 207
-#define KEY_sqrt 208
-#define KEY_srand 209
-#define KEY_stat 210
-#define KEY_state 211
-#define KEY_study 212
-#define KEY_sub 213
-#define KEY_substr 214
-#define KEY_symlink 215
-#define KEY_syscall 216
-#define KEY_sysopen 217
-#define KEY_sysread 218
-#define KEY_sysseek 219
-#define KEY_system 220
-#define KEY_syswrite 221
-#define KEY_tell 222
-#define KEY_telldir 223
-#define KEY_tie 224
-#define KEY_tied 225
-#define KEY_time 226
-#define KEY_times 227
-#define KEY_tr 228
-#define KEY_truncate 229
-#define KEY_uc 230
-#define KEY_ucfirst 231
-#define KEY_umask 232
-#define KEY_undef 233
-#define KEY_unless 234
-#define KEY_unlink 235
-#define KEY_unpack 236
-#define KEY_unshift 237
-#define KEY_untie 238
-#define KEY_until 239
-#define KEY_use 240
-#define KEY_utime 241
-#define KEY_values 242
-#define KEY_vec 243
-#define KEY_wait 244
-#define KEY_waitpid 245
-#define KEY_wantarray 246
-#define KEY_warn 247
-#define KEY_when 248
-#define KEY_while 249
-#define KEY_write 250
-#define KEY_x 251
-#define KEY_xor 252
-#define KEY_y 253
+#define KEY_caller 22
+#define KEY_chdir 23
+#define KEY_chmod 24
+#define KEY_chomp 25
+#define KEY_chop 26
+#define KEY_chown 27
+#define KEY_chr 28
+#define KEY_chroot 29
+#define KEY_close 30
+#define KEY_closedir 31
+#define KEY_cmp 32
+#define KEY_connect 33
+#define KEY_continue 34
+#define KEY_cos 35
+#define KEY_crypt 36
+#define KEY_dbmclose 37
+#define KEY_dbmopen 38
+#define KEY_defined 39
+#define KEY_delete 40
+#define KEY_die 41
+#define KEY_do 42
+#define KEY_dump 43
+#define KEY_each 44
+#define KEY_else 45
+#define KEY_elsif 46
+#define KEY_endgrent 47
+#define KEY_endhostent 48
+#define KEY_endnetent 49
+#define KEY_endprotoent 50
+#define KEY_endpwent 51
+#define KEY_endservent 52
+#define KEY_eof 53
+#define KEY_eq 54
+#define KEY_eval 55
+#define KEY_evalbytes 56
+#define KEY_exec 57
+#define KEY_exists 58
+#define KEY_exit 59
+#define KEY_exp 60
+#define KEY_fc 61
+#define KEY_fcntl 62
+#define KEY_fileno 63
+#define KEY_flock 64
+#define KEY_for 65
+#define KEY_foreach 66
+#define KEY_fork 67
+#define KEY_format 68
+#define KEY_formline 69
+#define KEY_ge 70
+#define KEY_getc 71
+#define KEY_getgrent 72
+#define KEY_getgrgid 73
+#define KEY_getgrnam 74
+#define KEY_gethostbyaddr 75
+#define KEY_gethostbyname 76
+#define KEY_gethostent 77
+#define KEY_getlogin 78
+#define KEY_getnetbyaddr 79
+#define KEY_getnetbyname 80
+#define KEY_getnetent 81
+#define KEY_getpeername 82
+#define KEY_getpgrp 83
+#define KEY_getppid 84
+#define KEY_getpriority 85
+#define KEY_getprotobyname 86
+#define KEY_getprotobynumber 87
+#define KEY_getprotoent 88
+#define KEY_getpwent 89
+#define KEY_getpwnam 90
+#define KEY_getpwuid 91
+#define KEY_getservbyname 92
+#define KEY_getservbyport 93
+#define KEY_getservent 94
+#define KEY_getsockname 95
+#define KEY_getsockopt 96
+#define KEY_given 97
+#define KEY_glob 98
+#define KEY_gmtime 99
+#define KEY_goto 100
+#define KEY_grep 101
+#define KEY_gt 102
+#define KEY_hex 103
+#define KEY_if 104
+#define KEY_index 105
+#define KEY_int 106
+#define KEY_ioctl 107
+#define KEY_join 108
+#define KEY_keys 109
+#define KEY_kill 110
+#define KEY_last 111
+#define KEY_lc 112
+#define KEY_lcfirst 113
+#define KEY_le 114
+#define KEY_length 115
+#define KEY_link 116
+#define KEY_listen 117
+#define KEY_local 118
+#define KEY_localtime 119
+#define KEY_lock 120
+#define KEY_log 121
+#define KEY_lstat 122
+#define KEY_lt 123
+#define KEY_m 124
+#define KEY_map 125
+#define KEY_mkdir 126
+#define KEY_msgctl 127
+#define KEY_msgget 128
+#define KEY_msgrcv 129
+#define KEY_msgsnd 130
+#define KEY_my 131
+#define KEY_ne 132
+#define KEY_next 133
+#define KEY_no 134
+#define KEY_not 135
+#define KEY_oct 136
+#define KEY_open 137
+#define KEY_opendir 138
+#define KEY_or 139
+#define KEY_ord 140
+#define KEY_our 141
+#define KEY_pack 142
+#define KEY_package 143
+#define KEY_pipe 144
+#define KEY_pop 145
+#define KEY_pos 146
+#define KEY_print 147
+#define KEY_printf 148
+#define KEY_prototype 149
+#define KEY_push 150
+#define KEY_q 151
+#define KEY_qq 152
+#define KEY_qr 153
+#define KEY_quotemeta 154
+#define KEY_qw 155
+#define KEY_qx 156
+#define KEY_rand 157
+#define KEY_read 158
+#define KEY_readdir 159
+#define KEY_readline 160
+#define KEY_readlink 161
+#define KEY_readpipe 162
+#define KEY_recv 163
+#define KEY_redo 164
+#define KEY_ref 165
+#define KEY_rename 166
+#define KEY_require 167
+#define KEY_reset 168
+#define KEY_return 169
+#define KEY_reverse 170
+#define KEY_rewinddir 171
+#define KEY_rindex 172
+#define KEY_rmdir 173
+#define KEY_s 174
+#define KEY_say 175
+#define KEY_scalar 176
+#define KEY_seek 177
+#define KEY_seekdir 178
+#define KEY_select 179
+#define KEY_semctl 180
+#define KEY_semget 181
+#define KEY_semop 182
+#define KEY_send 183
+#define KEY_setgrent 184
+#define KEY_sethostent 185
+#define KEY_setnetent 186
+#define KEY_setpgrp 187
+#define KEY_setpriority 188
+#define KEY_setprotoent 189
+#define KEY_setpwent 190
+#define KEY_setservent 191
+#define KEY_setsockopt 192
+#define KEY_shift 193
+#define KEY_shmctl 194
+#define KEY_shmget 195
+#define KEY_shmread 196
+#define KEY_shmwrite 197
+#define KEY_shutdown 198
+#define KEY_sin 199
+#define KEY_sleep 200
+#define KEY_socket 201
+#define KEY_socketpair 202
+#define KEY_sort 203
+#define KEY_splice 204
+#define KEY_split 205
+#define KEY_sprintf 206
+#define KEY_sqrt 207
+#define KEY_srand 208
+#define KEY_stat 209
+#define KEY_state 210
+#define KEY_study 211
+#define KEY_sub 212
+#define KEY_substr 213
+#define KEY_symlink 214
+#define KEY_syscall 215
+#define KEY_sysopen 216
+#define KEY_sysread 217
+#define KEY_sysseek 218
+#define KEY_system 219
+#define KEY_syswrite 220
+#define KEY_tell 221
+#define KEY_telldir 222
+#define KEY_tie 223
+#define KEY_tied 224
+#define KEY_time 225
+#define KEY_times 226
+#define KEY_tr 227
+#define KEY_truncate 228
+#define KEY_uc 229
+#define KEY_ucfirst 230
+#define KEY_umask 231
+#define KEY_undef 232
+#define KEY_unless 233
+#define KEY_unlink 234
+#define KEY_unpack 235
+#define KEY_unshift 236
+#define KEY_untie 237
+#define KEY_until 238
+#define KEY_use 239
+#define KEY_utime 240
+#define KEY_values 241
+#define KEY_vec 242
+#define KEY_wait 243
+#define KEY_waitpid 244
+#define KEY_wantarray 245
+#define KEY_warn 246
+#define KEY_when 247
+#define KEY_while 248
+#define KEY_write 249
+#define KEY_x 250
+#define KEY_xor 251
+#define KEY_y 252
/* Generated from:
- * 1e6a65fdd2e2d8aec28927cb9cbfed6e8a33ba077f0114b420746a04b0df8792 regen/keywords.pl
+ * 50664fad65e719c51bf369702163eb7ade79f997461f928cc20f1e1bcf8369b8 regen/keywords.pl
* ex: set ro: */
diff --git a/lib/B/Deparse-core.t b/lib/B/Deparse-core.t
index 2ed797ac7e..01a9b18305 100644
--- a/lib/B/Deparse-core.t
+++ b/lib/B/Deparse-core.t
@@ -36,7 +36,7 @@ BEGIN {
use strict;
use Test::More;
-plan tests => 3886;
+plan tests => 3874;
use feature (sprintf(":%vd", $^V)); # to avoid relying on the feature
# logic to add CORE::
@@ -461,7 +461,6 @@ atan2 2 p
bind 2 p
binmode 12 p
bless 1 p
-break 0 -
caller 0 -
chdir 01 -
chmod @ p1
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm
index 6823ebc8b4..02ea4bc5f0 100644
--- a/lib/B/Deparse.pm
+++ b/lib/B/Deparse.pm
@@ -2247,7 +2247,6 @@ my %feature_keywords = (
say => 'say',
given => 'switch',
when => 'switch',
- break => 'switch',
evalbytes=>'evalbytes',
__SUB__ => '__SUB__',
fc => 'fc',
@@ -2539,7 +2538,6 @@ sub pp_ggrgid { unop(@_, "getgrgid") }
sub pp_lock { unop(@_, "lock") }
sub pp_continue { unop(@_, "continue"); }
-sub pp_break { unop(@_, "break"); }
sub givwhen {
my $self = shift;
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index 6589700f19..156898652c 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -1514,7 +1514,7 @@ CORE::given ($x) {
CORE::when (3) {
continue;
}
- CORE::break;
+ next;
}
CORE::evalbytes '';
() = CORE::__SUB__;
@@ -1530,7 +1530,7 @@ CORE::given ($x) {
CORE::when (3) {
continue;
}
- CORE::break;
+ next;
}
CORE::evalbytes '';
() = CORE::__SUB__;
@@ -1541,7 +1541,7 @@ CORE::given ($x) {
CORE::when (3) {
continue;
}
- CORE::break;
+ next;
}
CORE::evalbytes '';
() = CORE::__SUB__;
@@ -1557,7 +1557,7 @@ CORE::given ($x) {
CORE::when (3) {
continue;
}
- CORE::break;
+ next;
}
CORE::evalbytes '';
() = CORE::__SUB__;
@@ -1570,7 +1570,7 @@ CORE::given ($x) {
CORE::when (3) {
continue;
}
- CORE::break;
+ next;
}
CORE::evalbytes '';
() = CORE::__SUB__;
diff --git a/opcode.h b/opcode.h
index 06b75cdd28..6e42af0dac 100644
--- a/opcode.h
+++ b/opcode.h
@@ -367,7 +367,6 @@ EXTCONST char* const PL_op_name[] = {
"leavegiven",
"enterwhen",
"leavewhen",
- "break",
"continue",
"open",
"close",
@@ -772,7 +771,6 @@ EXTCONST char* const PL_op_desc[] = {
"leave given block",
"when()",
"leave when block",
- "break",
"continue",
"open",
"close",
@@ -1189,7 +1187,6 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
Perl_pp_leavegiven,
Perl_pp_enterwhen,
Perl_pp_leavewhen,
- Perl_pp_break,
Perl_pp_continue,
Perl_pp_open,
Perl_pp_close,
@@ -1602,7 +1599,6 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
Perl_ck_null, /* leavegiven */
Perl_ck_null, /* enterwhen */
Perl_ck_null, /* leavewhen */
- Perl_ck_null, /* break */
Perl_ck_null, /* continue */
Perl_ck_open, /* open */
Perl_ck_fun, /* close */
@@ -2011,7 +2007,6 @@ EXTCONST U32 PL_opargs[] = {
0x00000100, /* leavegiven */
0x00000340, /* enterwhen */
0x00000100, /* leavewhen */
- 0x00000000, /* break */
0x00000000, /* continue */
0x0029640d, /* open */
0x0000eb04, /* close */
@@ -2677,7 +2672,6 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = {
0, /* leavegiven */
0, /* enterwhen */
0, /* leavewhen */
- -1, /* break */
-1, /* continue */
189, /* open */
52, /* close */
@@ -3169,7 +3163,6 @@ EXTCONST U8 PL_op_private_valid[] = {
/* LEAVEGIVEN */ (OPpARG1_MASK),
/* ENTERWHEN */ (OPpARG1_MASK),
/* LEAVEWHEN */ (OPpARG1_MASK),
- /* BREAK */ (0),
/* CONTINUE */ (0),
/* OPEN */ (OPpARG4_MASK|OPpOPEN_IN_RAW|OPpOPEN_IN_CRLF|OPpOPEN_OUT_RAW|OPpOPEN_OUT_CRLF),
/* CLOSE */ (OPpARG4_MASK),
diff --git a/opnames.h b/opnames.h
index d87ba88f01..ed4155eeeb 100644
--- a/opnames.h
+++ b/opnames.h
@@ -235,186 +235,185 @@ typedef enum opcode {
OP_LEAVEGIVEN = 218,
OP_ENTERWHEN = 219,
OP_LEAVEWHEN = 220,
- OP_BREAK = 221,
- OP_CONTINUE = 222,
- OP_OPEN = 223,
- OP_CLOSE = 224,
- OP_PIPE_OP = 225,
- OP_FILENO = 226,
- OP_UMASK = 227,
- OP_BINMODE = 228,
- OP_TIE = 229,
- OP_UNTIE = 230,
- OP_TIED = 231,
- OP_DBMOPEN = 232,
- OP_DBMCLOSE = 233,
- OP_SSELECT = 234,
- OP_SELECT = 235,
- OP_GETC = 236,
- OP_READ = 237,
- OP_ENTERWRITE = 238,
- OP_LEAVEWRITE = 239,
- OP_PRTF = 240,
- OP_PRINT = 241,
- OP_SAY = 242,
- OP_SYSOPEN = 243,
- OP_SYSSEEK = 244,
- OP_SYSREAD = 245,
- OP_SYSWRITE = 246,
- OP_EOF = 247,
- OP_TELL = 248,
- OP_SEEK = 249,
- OP_TRUNCATE = 250,
- OP_FCNTL = 251,
- OP_IOCTL = 252,
- OP_FLOCK = 253,
- OP_SEND = 254,
- OP_RECV = 255,
- OP_SOCKET = 256,
- OP_SOCKPAIR = 257,
- OP_BIND = 258,
- OP_CONNECT = 259,
- OP_LISTEN = 260,
- OP_ACCEPT = 261,
- OP_SHUTDOWN = 262,
- OP_GSOCKOPT = 263,
- OP_SSOCKOPT = 264,
- OP_GETSOCKNAME = 265,
- OP_GETPEERNAME = 266,
- OP_LSTAT = 267,
- OP_STAT = 268,
- OP_FTRREAD = 269,
- OP_FTRWRITE = 270,
- OP_FTREXEC = 271,
- OP_FTEREAD = 272,
- OP_FTEWRITE = 273,
- OP_FTEEXEC = 274,
- OP_FTIS = 275,
- OP_FTSIZE = 276,
- OP_FTMTIME = 277,
- OP_FTATIME = 278,
- OP_FTCTIME = 279,
- OP_FTROWNED = 280,
- OP_FTEOWNED = 281,
- OP_FTZERO = 282,
- OP_FTSOCK = 283,
- OP_FTCHR = 284,
- OP_FTBLK = 285,
- OP_FTFILE = 286,
- OP_FTDIR = 287,
- OP_FTPIPE = 288,
- OP_FTSUID = 289,
- OP_FTSGID = 290,
- OP_FTSVTX = 291,
- OP_FTLINK = 292,
- OP_FTTTY = 293,
- OP_FTTEXT = 294,
- OP_FTBINARY = 295,
- OP_CHDIR = 296,
- OP_CHOWN = 297,
- OP_CHROOT = 298,
- OP_UNLINK = 299,
- OP_CHMOD = 300,
- OP_UTIME = 301,
- OP_RENAME = 302,
- OP_LINK = 303,
- OP_SYMLINK = 304,
- OP_READLINK = 305,
- OP_MKDIR = 306,
- OP_RMDIR = 307,
- OP_OPEN_DIR = 308,
- OP_READDIR = 309,
- OP_TELLDIR = 310,
- OP_SEEKDIR = 311,
- OP_REWINDDIR = 312,
- OP_CLOSEDIR = 313,
- OP_FORK = 314,
- OP_WAIT = 315,
- OP_WAITPID = 316,
- OP_SYSTEM = 317,
- OP_EXEC = 318,
- OP_KILL = 319,
- OP_GETPPID = 320,
- OP_GETPGRP = 321,
- OP_SETPGRP = 322,
- OP_GETPRIORITY = 323,
- OP_SETPRIORITY = 324,
- OP_TIME = 325,
- OP_TMS = 326,
- OP_LOCALTIME = 327,
- OP_GMTIME = 328,
- OP_ALARM = 329,
- OP_SLEEP = 330,
- OP_SHMGET = 331,
- OP_SHMCTL = 332,
- OP_SHMREAD = 333,
- OP_SHMWRITE = 334,
- OP_MSGGET = 335,
- OP_MSGCTL = 336,
- OP_MSGSND = 337,
- OP_MSGRCV = 338,
- OP_SEMOP = 339,
- OP_SEMGET = 340,
- OP_SEMCTL = 341,
- OP_REQUIRE = 342,
- OP_DOFILE = 343,
- OP_HINTSEVAL = 344,
- OP_ENTEREVAL = 345,
- OP_LEAVEEVAL = 346,
- OP_ENTERTRY = 347,
- OP_LEAVETRY = 348,
- OP_GHBYNAME = 349,
- OP_GHBYADDR = 350,
- OP_GHOSTENT = 351,
- OP_GNBYNAME = 352,
- OP_GNBYADDR = 353,
- OP_GNETENT = 354,
- OP_GPBYNAME = 355,
- OP_GPBYNUMBER = 356,
- OP_GPROTOENT = 357,
- OP_GSBYNAME = 358,
- OP_GSBYPORT = 359,
- OP_GSERVENT = 360,
- OP_SHOSTENT = 361,
- OP_SNETENT = 362,
- OP_SPROTOENT = 363,
- OP_SSERVENT = 364,
- OP_EHOSTENT = 365,
- OP_ENETENT = 366,
- OP_EPROTOENT = 367,
- OP_ESERVENT = 368,
- OP_GPWNAM = 369,
- OP_GPWUID = 370,
- OP_GPWENT = 371,
- OP_SPWENT = 372,
- OP_EPWENT = 373,
- OP_GGRNAM = 374,
- OP_GGRGID = 375,
- OP_GGRENT = 376,
- OP_SGRENT = 377,
- OP_EGRENT = 378,
- OP_GETLOGIN = 379,
- OP_SYSCALL = 380,
- OP_LOCK = 381,
- OP_ONCE = 382,
- OP_CUSTOM = 383,
- OP_COREARGS = 384,
- OP_AVHVSWITCH = 385,
- OP_RUNCV = 386,
- OP_FC = 387,
- OP_PADCV = 388,
- OP_INTROCV = 389,
- OP_CLONECV = 390,
- OP_PADRANGE = 391,
- OP_REFASSIGN = 392,
- OP_LVREF = 393,
- OP_LVREFSLICE = 394,
- OP_LVAVREF = 395,
- OP_ANONCONST = 396,
+ OP_CONTINUE = 221,
+ OP_OPEN = 222,
+ OP_CLOSE = 223,
+ OP_PIPE_OP = 224,
+ OP_FILENO = 225,
+ OP_UMASK = 226,
+ OP_BINMODE = 227,
+ OP_TIE = 228,
+ OP_UNTIE = 229,
+ OP_TIED = 230,
+ OP_DBMOPEN = 231,
+ OP_DBMCLOSE = 232,
+ OP_SSELECT = 233,
+ OP_SELECT = 234,
+ OP_GETC = 235,
+ OP_READ = 236,
+ OP_ENTERWRITE = 237,
+ OP_LEAVEWRITE = 238,
+ OP_PRTF = 239,
+ OP_PRINT = 240,
+ OP_SAY = 241,
+ OP_SYSOPEN = 242,
+ OP_SYSSEEK = 243,
+ OP_SYSREAD = 244,
+ OP_SYSWRITE = 245,
+ OP_EOF = 246,
+ OP_TELL = 247,
+ OP_SEEK = 248,
+ OP_TRUNCATE = 249,
+ OP_FCNTL = 250,
+ OP_IOCTL = 251,
+ OP_FLOCK = 252,
+ OP_SEND = 253,
+ OP_RECV = 254,
+ OP_SOCKET = 255,
+ OP_SOCKPAIR = 256,
+ OP_BIND = 257,
+ OP_CONNECT = 258,
+ OP_LISTEN = 259,
+ OP_ACCEPT = 260,
+ OP_SHUTDOWN = 261,
+ OP_GSOCKOPT = 262,
+ OP_SSOCKOPT = 263,
+ OP_GETSOCKNAME = 264,
+ OP_GETPEERNAME = 265,
+ OP_LSTAT = 266,
+ OP_STAT = 267,
+ OP_FTRREAD = 268,
+ OP_FTRWRITE = 269,
+ OP_FTREXEC = 270,
+ OP_FTEREAD = 271,
+ OP_FTEWRITE = 272,
+ OP_FTEEXEC = 273,
+ OP_FTIS = 274,
+ OP_FTSIZE = 275,
+ OP_FTMTIME = 276,
+ OP_FTATIME = 277,
+ OP_FTCTIME = 278,
+ OP_FTROWNED = 279,
+ OP_FTEOWNED = 280,
+ OP_FTZERO = 281,
+ OP_FTSOCK = 282,
+ OP_FTCHR = 283,
+ OP_FTBLK = 284,
+ OP_FTFILE = 285,
+ OP_FTDIR = 286,
+ OP_FTPIPE = 287,
+ OP_FTSUID = 288,
+ OP_FTSGID = 289,
+ OP_FTSVTX = 290,
+ OP_FTLINK = 291,
+ OP_FTTTY = 292,
+ OP_FTTEXT = 293,
+ OP_FTBINARY = 294,
+ OP_CHDIR = 295,
+ OP_CHOWN = 296,
+ OP_CHROOT = 297,
+ OP_UNLINK = 298,
+ OP_CHMOD = 299,
+ OP_UTIME = 300,
+ OP_RENAME = 301,
+ OP_LINK = 302,
+ OP_SYMLINK = 303,
+ OP_READLINK = 304,
+ OP_MKDIR = 305,
+ OP_RMDIR = 306,
+ OP_OPEN_DIR = 307,
+ OP_READDIR = 308,
+ OP_TELLDIR = 309,
+ OP_SEEKDIR = 310,
+ OP_REWINDDIR = 311,
+ OP_CLOSEDIR = 312,
+ OP_FORK = 313,
+ OP_WAIT = 314,
+ OP_WAITPID = 315,
+ OP_SYSTEM = 316,
+ OP_EXEC = 317,
+ OP_KILL = 318,
+ OP_GETPPID = 319,
+ OP_GETPGRP = 320,
+ OP_SETPGRP = 321,
+ OP_GETPRIORITY = 322,
+ OP_SETPRIORITY = 323,
+ OP_TIME = 324,
+ OP_TMS = 325,
+ OP_LOCALTIME = 326,
+ OP_GMTIME = 327,
+ OP_ALARM = 328,
+ OP_SLEEP = 329,
+ OP_SHMGET = 330,
+ OP_SHMCTL = 331,
+ OP_SHMREAD = 332,
+ OP_SHMWRITE = 333,
+ OP_MSGGET = 334,
+ OP_MSGCTL = 335,
+ OP_MSGSND = 336,
+ OP_MSGRCV = 337,
+ OP_SEMOP = 338,
+ OP_SEMGET = 339,
+ OP_SEMCTL = 340,
+ OP_REQUIRE = 341,
+ OP_DOFILE = 342,
+ OP_HINTSEVAL = 343,
+ OP_ENTEREVAL = 344,
+ OP_LEAVEEVAL = 345,
+ OP_ENTERTRY = 346,
+ OP_LEAVETRY = 347,
+ OP_GHBYNAME = 348,
+ OP_GHBYADDR = 349,
+ OP_GHOSTENT = 350,
+ OP_GNBYNAME = 351,
+ OP_GNBYADDR = 352,
+ OP_GNETENT = 353,
+ OP_GPBYNAME = 354,
+ OP_GPBYNUMBER = 355,
+ OP_GPROTOENT = 356,
+ OP_GSBYNAME = 357,
+ OP_GSBYPORT = 358,
+ OP_GSERVENT = 359,
+ OP_SHOSTENT = 360,
+ OP_SNETENT = 361,
+ OP_SPROTOENT = 362,
+ OP_SSERVENT = 363,
+ OP_EHOSTENT = 364,
+ OP_ENETENT = 365,
+ OP_EPROTOENT = 366,
+ OP_ESERVENT = 367,
+ OP_GPWNAM = 368,
+ OP_GPWUID = 369,
+ OP_GPWENT = 370,
+ OP_SPWENT = 371,
+ OP_EPWENT = 372,
+ OP_GGRNAM = 373,
+ OP_GGRGID = 374,
+ OP_GGRENT = 375,
+ OP_SGRENT = 376,
+ OP_EGRENT = 377,
+ OP_GETLOGIN = 378,
+ OP_SYSCALL = 379,
+ OP_LOCK = 380,
+ OP_ONCE = 381,
+ OP_CUSTOM = 382,
+ OP_COREARGS = 383,
+ OP_AVHVSWITCH = 384,
+ OP_RUNCV = 385,
+ OP_FC = 386,
+ OP_PADCV = 387,
+ OP_INTROCV = 388,
+ OP_CLONECV = 389,
+ OP_PADRANGE = 390,
+ OP_REFASSIGN = 391,
+ OP_LVREF = 392,
+ OP_LVREFSLICE = 393,
+ OP_LVAVREF = 394,
+ OP_ANONCONST = 395,
OP_max
} opcode;
-#define MAXO 397
+#define MAXO 396
#define OP_FREED MAXO
/* the OP_IS_* macros are optimized to a simple range check because
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 84ddac4060..a9a503e16d 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -759,15 +759,6 @@ to compress something else. See L<perlfunc/pack>.
(F) Only hard references may be blessed. This is how Perl "enforces"
encapsulation of objects. See L<perlobj>.
-=item Can't "break" in a loop topicalizer
-
-(F) You called C<break>, but you're in a C<foreach> block rather than
-a C<given> block. You probably meant to use C<next> or C<last>.
-
-=item Can't "break" outside a given block
-
-(F) You called C<break>, but you're not inside a C<given> block.
-
=item Can't call method "%s" on an undefined value
(F) You used the syntax of a method call, but the slot filled by the
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 727a6cdf89..d55bf2e6a7 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -255,7 +255,7 @@ X<control flow>
=for Pod::Functions =Flow
-L<C<break>|/break>, L<C<caller>|/caller EXPR>,
+L<C<caller>|/caller EXPR>,
L<C<continue>|/continue BLOCK>, L<C<die>|/die LIST>, L<C<do>|/do BLOCK>,
L<C<dump>|/dump LABEL>, L<C<eval>|/eval EXPR>,
L<C<evalbytes>|/evalbytes EXPR>, L<C<exit>|/exit EXPR>,
@@ -266,16 +266,9 @@ L<C<redo>|/redo LABEL>, L<C<return>|/return EXPR>,
L<C<sub>|/sub NAME BLOCK>, L<C<__SUB__>|/__SUB__>,
L<C<wantarray>|/wantarray>
-L<C<break>|/break> is available only if you enable the experimental
-L<C<"switch"> feature|feature/The 'switch' feature> or use the C<CORE::>
-prefix. The L<C<"switch"> feature|feature/The 'switch' feature> also
-enables the C<given> and C<when> statements, which are
-documented in L<perlsyn/"Switch Statements">.
-The L<C<"switch"> feature|feature/The 'switch' feature> is enabled
-automatically with a C<use v5.10> (or higher) declaration in the current
-scope. In Perl v5.14 and earlier, L<C<continue>|/continue BLOCK>
-required the L<C<"switch"> feature|feature/The 'switch' feature>, like
-the other keywords.
+In Perl v5.14 and earlier, L<C<continue>|/continue BLOCK>
+required the L<C<"switch"> feature|feature/The 'switch' feature> to
+be enabled.
L<C<evalbytes>|/evalbytes EXPR> is only available with the
L<C<"evalbytes"> feature|feature/The 'unicode_eval' and 'evalbytes' features>
@@ -908,21 +901,6 @@ that CLASSNAME is a true value.
See L<perlmod/"Perl Modules">.
-=item break
-
-=for Pod::Functions +switch break out of a C<given> block
-
-Break out of a C<given> block. Will signal an error if there is a
-closer C<foreach> block. The search is for the closest dynamically
-enclosing topicalizer.
-
-L<C<break>|/break> is available only if the
-L<C<"switch"> feature|feature/The 'switch' feature> is enabled or if it
-is prefixed with C<CORE::>. The
-L<C<"switch"> feature|feature/The 'switch' feature> is enabled
-automatically with a C<use v5.10> (or higher) declaration in the current
-scope.
-
=item caller EXPR
X<caller> X<call stack> X<stack> X<stack trace>
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index 480b352e7c..9febd729a4 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -620,8 +620,8 @@ example:
use v5.14;
-Under the "switch" feature, Perl gains the experimental keywords C<given>,
-C<when>, and C<break>. Starting from Perl 5.16, one can
+Under the "switch" feature, Perl gains the experimental keywords C<given>
+and C<when>. Starting from Perl 5.16, one can
prefix the switch keywords with C<CORE::> to access the feature without
a C<use feature> statement.
@@ -676,12 +676,6 @@ less punctuation as
$nothing = 1;
}
-You can use the C<break> keyword to break out of the dynamically enclosing
-topicalizer, if it's a C<given> block. This resembles the jump to the end
-of the topicalizer that implicitly happens at the end of every C<when>
-block, except that the explicit C<break> can only break
-out of a C<given> topicalizer, not a C<foreach>.
-
You can use the C<continue> keyword to exit a C<when>
block, proceeding to the following statement. This is most commonly
done last thing inside the block, to override the implicit jump to the
@@ -701,8 +695,7 @@ so providing the subroutine's return value, it evaluates to:
=item *
-An empty list as soon as an explicit C<break>, C<next>, or C<last>
-is encountered.
+An empty list as soon as an explicit C<next> or C<last> is encountered.
=item *
diff --git a/pp_ctl.c b/pp_ctl.c
index de7ac5865c..37ffb0edb9 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4739,29 +4739,6 @@ PP(pp_continue)
return nextop;
}
-PP(pp_break)
-{
- I32 cxix;
- PERL_CONTEXT *cx;
-
- cxix = dopoptogivenfor(cxstack_ix);
- if (cxix < 0)
- DIE(aTHX_ "Can't \"break\" outside a given block");
-
- cx = &cxstack[cxix];
- if (CxFOREACH(cx))
- DIE(aTHX_ "Can't \"break\" in a loop topicalizer");
-
- if (cxix < cxstack_ix)
- dounwind(cxix);
-
- /* Restore the sp at the time we entered the given block */
- cx = CX_CUR();
- PL_stack_sp = PL_stack_base + cx->blk_oldsp;
-
- return cx->blk_loop.my_op->op_nextop;
-}
-
static MAGIC *
S_doparseform(pTHX_ SV *sv)
{
diff --git a/pp_proto.h b/pp_proto.h
index 407cbd14a3..34fa56d959 100644
--- a/pp_proto.h
+++ b/pp_proto.h
@@ -32,7 +32,6 @@ PERL_CALLCONV OP *Perl_pp_binmode(pTHX);
PERL_CALLCONV OP *Perl_pp_bit_and(pTHX);
PERL_CALLCONV OP *Perl_pp_bit_or(pTHX);
PERL_CALLCONV OP *Perl_pp_bless(pTHX);
-PERL_CALLCONV OP *Perl_pp_break(pTHX);
PERL_CALLCONV OP *Perl_pp_caller(pTHX);
PERL_CALLCONV OP *Perl_pp_chdir(pTHX);
PERL_CALLCONV OP *Perl_pp_chop(pTHX);
diff --git a/regen/keywords.pl b/regen/keywords.pl
index 1ee1f2937a..e7aecf0436 100755
--- a/regen/keywords.pl
+++ b/regen/keywords.pl
@@ -41,7 +41,6 @@ my %feature_kw = (
given => 'switch',
when => 'switch',
# continue is already a keyword
- break => 'switch',
evalbytes => 'evalbytes',
__SUB__ => '__SUB__',
fc => 'fc',
@@ -128,7 +127,6 @@ __END__
-bind
-binmode
-bless
--break
-caller
-chdir
-chmod
diff --git a/regen/opcodes b/regen/opcodes
index b60eda097b..037ac89f0f 100644
--- a/regen/opcodes
+++ b/regen/opcodes
@@ -332,7 +332,6 @@ entergiven given() ck_null d{
leavegiven leave given block ck_null 1
enterwhen when() ck_null d|
leavewhen leave when block ck_null 1
-break break ck_null 0
continue continue ck_null 0
# I/O.
diff --git a/t/lib/feature/switch b/t/lib/feature/switch
index 0d3fab2b3d..7d0bfd5e23 100644
--- a/t/lib/feature/switch
+++ b/t/lib/feature/switch
@@ -16,13 +16,6 @@ EXPECT
Unquoted string "when" may clash with future reserved word at - line 3.
when
########
-# No switch; break should be a bareword.
-use warnings; no warnings 'experimental::smartmatch';
-print STDOUT break;
-EXPECT
-Unquoted string "break" may clash with future reserved word at - line 3.
-break
-########
# No switch; but continue is still a keyword
print STDOUT continue;
EXPECT
@@ -40,12 +33,6 @@ given(1) { when(1) { print "okay" } }
EXPECT
okay
########
-# Use switch; so break is a keyword
-use feature 'switch';
-break;
-EXPECT
-Can't "break" outside a given block at - line 3.
-########
# switch out of scope; given should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
{ use feature 'switch';
@@ -68,16 +55,6 @@ Unquoted string "when" may clash with future reserved word at - line 6.
Okay here
when
########
-# switch out of scope; break should be a bareword.
-use warnings; no warnings 'experimental::smartmatch';
-{ use feature 'switch';
- given (1) { break }
-}
-print STDOUT break;
-EXPECT
-Unquoted string "break" may clash with future reserved word at - line 6.
-break
-########
# C<no feature 'switch'> should work
use warnings; no warnings 'experimental::smartmatch';
use feature 'switch';
@@ -99,20 +76,3 @@ EXPECT
Unquoted string "when" may clash with future reserved word at - line 6.
Okay here
when
-########
-# Without the feature, no 'Unambiguous use of' warning:
-use warnings; no warnings 'experimental::smartmatch';
-@break = ($break = "break");
-print ${break}, ${break[0]};
-EXPECT
-breakbreak
-########
-# With the feature, we get an 'Unambiguous use of' warning:
-use warnings; no warnings 'experimental::smartmatch';
-use feature 'switch';
-@break = ($break = "break");
-print ${break}, ${break[0]};
-EXPECT
-Ambiguous use of ${break} resolved to $break at - line 5.
-Ambiguous use of ${break[...]} resolved to $break[...] at - line 5.
-breakbreak
diff --git a/t/op/coreamp.t b/t/op/coreamp.t
index 277ac1094a..c553a510d1 100644
--- a/t/op/coreamp.t
+++ b/t/op/coreamp.t
@@ -370,18 +370,6 @@ like join(" ", &CORE::bless([],'parcel')),
qr/^parcel=ARRAY(?!.* )/, "&bless in list context";
like &mybless([]), qr/^main=ARRAY/, '&bless with one arg';
-test_proto 'break';
-{ $tests ++;
- my $tmp;
- CORE::given(1) {
- CORE::when(1) {
- &mybreak;
- $tmp = 'bad';
- }
- }
- is $tmp, undef, '&break';
-}
-
test_proto 'caller';
$tests += 4;
sub caller_test {
diff --git a/t/op/cproto.t b/t/op/cproto.t
index 66425db9cd..711d253dde 100644
--- a/t/op/cproto.t
+++ b/t/op/cproto.t
@@ -7,7 +7,7 @@ BEGIN {
set_up_inc('../lib');
}
-plan tests => 253;
+plan tests => 252;
while (<DATA>) {
chomp;
@@ -51,7 +51,6 @@ atan2 ($$)
bind (*$)
binmode (*;$)
bless ($;$)
-break ()
caller (;$)
chdir (;$)
chmod (@)
diff --git a/t/op/switch.t b/t/op/switch.t
index 5fdda90f42..0b5761bccb 100644
--- a/t/op/switch.t
+++ b/t/op/switch.t
@@ -10,7 +10,7 @@ use strict;
use warnings;
no warnings 'experimental::smartmatch';
-plan tests => 164;
+plan tests => 161;
# The behaviour of the feature pragma should be tested by lib/feature.t
# using the tests in t/lib/feature/*. This file tests the behaviour of
@@ -29,9 +29,6 @@ use feature 'switch';
eval { continue };
like($@, qr/^Can't "continue" outside/, "continue outside");
-eval { break };
-like($@, qr/^Can't "break" outside/, "break outside");
-
# Scoping rules
{
@@ -590,14 +587,10 @@ my $f = tie my $v, "FetchCounter";
for (1, "two") {
when ($_ eq "two") {
is($first, 0, "Loop: second");
- eval {break};
- like($@, qr/^Can't "break" in a loop topicalizer/,
- q{Can't "break" in a loop topicalizer});
}
when ($_ == 1) {
is($first, 1, "Loop: first");
$first = 0;
- # Implicit break is okay
}
}
}
@@ -607,14 +600,10 @@ my $f = tie my $v, "FetchCounter";
for $_ (1, "two") {
when ($_ eq "two") {
is($first, 0, "Explicit \$_: second");
- eval {break};
- like($@, qr/^Can't "break" in a loop topicalizer/,
- q{Can't "break" in a loop topicalizer});
}
when ($_ == 1) {
is($first, 1, "Explicit \$_: first");
$first = 0;
- # Implicit break is okay
}
}
}
@@ -709,7 +698,7 @@ sub contains_x {
do { $ok = 1; continue } when /pea/;
$ok += 2;
$ok = 0 when /pie/;
- $ok += 4; break;
+ $ok += 4; next;
$ok = 0;
}
is($ok, 7, "postfix regex");
@@ -762,7 +751,7 @@ is($letter, "a,c,e,", "next LABEL in when");
goto GIVEN1;
$flag = 1;
GIVEN1: given ($flag) {
- when ($_ == 0) { break; }
+ when ($_ == 0) { next; }
$flag = 2;
}
is($flag, 0, "goto GIVEN1");
@@ -800,7 +789,7 @@ GIVEN4:
GIVEN5:
given ($flag) {
when ($_ == 0) { $flag = 1; goto GIVEN5; $flag = 2; }
- when ($_ == 1) { break; }
+ when ($_ == 1) { next; }
$flag = 3;
}
is($flag, 1, "goto inside given and when to the given stmt");
@@ -893,7 +882,7 @@ GIVEN5:
F: for (0, 1, 2, 3) {
my @list = do { given ($_) {
continue when $_ <= 1;
- break when $_ == 1;
+ next when $_ == 1;
next F when $_ == 2;
6, 7;
} };
@@ -1041,7 +1030,7 @@ GIVEN5:
my @descriptions = qw<
when
- break
+ next
continue
default
>;
@@ -1057,7 +1046,7 @@ GIVEN5:
given ($id) {
my $x;
when ($_ == 0) { Fmurrr->new($destroyed, 0) }
- when ($_ == 1) { my $y = Fmurrr->new($destroyed, 1); break }
+ when ($_ == 1) { my $y = Fmurrr->new($destroyed, 1); next }
when ($_ == 2) { $x = Fmurrr->new($destroyed, 2); continue }
when ($_ == 2) { $x }
Fmurrr->new($destroyed, 3);
@@ -1065,25 +1054,25 @@ GIVEN5:
};
$res_id = $res->{id};
}
- $res_id = $id if $id == 1; # break doesn't return anything
+ $res_id = $id if $id == 1; # next doesn't return anything
is $res_id, $id, "given/when returns the right object - $desc";
is $destroyed, 1, "given/when does not leak - $desc";
};
}
-# break() must reset the stack
+# next() must reset the stack
{
my @res = (1, do {
given ("x") {
2, 3, do {
when (/[a-z]/) {
- 4, 5, 6, break
+ 4, 5, 6, next
}
}
}
});
- is "@res", "1", "break resets the stack";
+ is "@res", "1", "next resets the stack";
}
# RT #94682:
diff --git a/toke.c b/toke.c
index 09675124e9..8b87058d75 100644
--- a/toke.c
+++ b/toke.c
@@ -7782,9 +7782,6 @@ Perl_yylex(pTHX)
case KEY_bless:
LOP(OP_BLESS,XTERM);
- case KEY_break:
- FUN0(OP_BREAK);
-
case KEY_chop:
UNI(OP_CHOP);