New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$ref->$var = $$var produces unexpected optree near method call #4368
Comments
From anthony@asd.ppp0.comHere is a complete test script: $ref->$var = $$var; The result of perl -c on this is: panic: unexpected optree near method call at /tmp/test.pl line 1, near "$var;" Syntacticly, I don't think there is anything wrong above. Logically, Perl Info
|
From @mjdominusx->$var = 1 produces the same result. |
From [Unknown Contact. See original ticket]
Damn! I'm always amazed at the quick response of the perl community! And in the special case of $ref being a hash, $ref->{$var} = $$var doesn't |
From @rgarciaSo let's remove the check ! $x = 1; I suppose that something like this should be added to t/op/sub_lval.t. Inline Patch--- op.c.orig Sun Sep 2 12:32:42 2001
+++ op.c Mon Sep 3 14:43:43 2001
@@ -1444,11 +1444,6 @@
{
UNOP *newop;
- if (kid->op_sibling || kid->op_next != kid) {
- yyerror("panic: unexpected optree near method call");
- break;
- }
-
NewOp(1101, newop, 1, UNOP);
newop->op_type = OP_RV2CV;
newop->op_ppaddr = PL_ppaddr[OP_RV2CV]; |
From [Unknown Contact. See original ticket]
I was using it as a name of a method, e.g., $f = new Foo::Bar; A simular thing is on pp. 313 of the Camel book. |
From @rgarciaYes, using a string or a coderef doesn't affect the behavior of the bug Looking into this a little deeper, I have the feeling that the patch The initial patch is here : |
From @rgarciaShortly, the bug is a parser panic : $ perl -e '$x="y";main->$x=1' With the patch : $ bperl -e '$x="y";main->$x=1' Inline Patch--- t/op/method.t.orig Fri Jul 6 15:56:23 2001
+++ t/op/method.t Fri Nov 30 23:27:50 2001
@@ -9,7 +9,7 @@
@INC = '../lib';
}
-print "1..72\n";
+print "1..73\n";
@A::ISA = 'B';
@B::ISA = 'C';
@@ -239,5 +239,14 @@
# print foo "bar" where foo does not exist is an indirect object.
eval { sub AUTOLOAD { "ok ", shift, "\n"; } };
print nonsuch(++$cnt);
+
+# Bug ID 20010902.002
+test (
+ eval q[
+ $x = 'x';
+ sub Foo::x : lvalue { $x }
+ Foo->$x = 'ok';
+ ] || $@, 'ok'
+);
print "# $cnt tests completed\n";
--- op.c.orig Thu Nov 22 05:48:18 2001
+++ op.c Fri Nov 30 23:16:56 2001
@@ -1446,11 +1446,6 @@
|| kid->op_type == OP_METHOD)
{
UNOP *newop;
-
- if (kid->op_sibling || kid->op_next != kid) {
- yyerror("panic: unexpected optree near method call");
- break;
- }
NewOp(1101, newop, 1, UNOP);
newop->op_type = OP_RV2CV; |
From @jhiThanks, applied. -- |
@cwest - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#7609 (status was 'resolved')
Searchable as RT7609$
The text was updated successfully, but these errors were encountered: