From: Father Chrysostomos Date: Tue, 12 Nov 2013 14:13:44 +0000 (-0800) Subject: Compile-time checking for %$obj{"key"} under ‘use fields’ X-Git-Tag: upstream/5.20.0~1237 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5f75dbad5e3c30268ca3c689bf1f3316d2c3a5a;p=platform%2Fupstream%2Fperl.git Compile-time checking for %$obj{"key"} under ‘use fields’ This single line of code also gives us shared hash key optimisa- tions for free. --- diff --git a/op.c b/op.c index 625eabaf7c..412a5ce787 100644 --- a/op.c +++ b/op.c @@ -1935,6 +1935,7 @@ S_finalize_op(pTHX_ OP* o) case OP_HSLICE: S_scalar_slice_warning(aTHX_ o); + case OP_KVHSLICE: if (/* I bet there's always a pushmark... */ (kid = cLISTOPo->op_first->op_sibling)->op_type != OP_LIST && kid->op_type != OP_CONST) diff --git a/t/lib/croak/op b/t/lib/croak/op index 3ec418ffd4..4cc82af2f9 100644 --- a/t/lib/croak/op +++ b/t/lib/croak/op @@ -43,6 +43,13 @@ my main $f; EXPECT No such class field "a" in variable $f of type main at - line 3. ######## +# NAME OP_KVHSLICE fields +BEGIN { %FIELDS = qw(a 1 b 1); } +my main $f; +%$f{"a","c"}; +EXPECT +No such class field "c" in variable $f of type main at - line 3. +######## # NAME delete BAD delete $x; EXPECT