develooper Front page | perl.perl5.changes | Postings from February 2021

[Perl/perl5] 534905: try isn't treated as a sub call like eval is

From:
Paul Evans via perl5-changes
Date:
February 14, 2021 12:22
Subject:
[Perl/perl5] 534905: try isn't treated as a sub call like eval is
Message ID:
Perl/perl5/push/refs/heads/leonerd/feature-try-2/805157-174986@github.com
  Branch: refs/heads/leonerd/feature-try-2
  Home:   https://github.com/Perl/perl5
  Commit: 534905e2578cf97763b1f5748c1843f3b568c7e0
      https://github.com/Perl/perl5/commit/534905e2578cf97763b1f5748c1843f3b568c7e0
  Author: Tony Cook <tony@develop-help.com>
  Date:   2021-02-14 (Sun, 14 Feb 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M inline.h
    M pp_ctl.c
    M proto.h

  Log Message:
  -----------
  try isn't treated as a sub call like eval is

The try change added code to pp_return to skip past try contexts
when looking for the sub/sort/eval context to return from.

This was only needed because cx_pusheval() sets si_cxsubix to the
current frame and try uses that function to push it's context, that
value is then used by the dopopto_cursub() macro to shortcut
walking the context stack.

Since we don't need to treat try as a sub for return, list vs array
checks or lvalue sub checks, don't set si_cxsubix on try.


  Commit: 1749867ba0fd457cacc00c4bff589ef89cac0025
      https://github.com/Perl/perl5/commit/1749867ba0fd457cacc00c4bff589ef89cac0025
  Author: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
  Date:   2021-02-14 (Sun, 14 Feb 2021)

  Changed paths:
    M t/op/try.t

  Log Message:
  -----------
  Unit-test that try{return} within :lvalue sub behaves correctly (GH#18553)


Compare: https://github.com/Perl/perl5/compare/8051578baf52...1749867ba0fd



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About