From aabb9e52d697538932605945da1723db1dad0280 Mon Sep 17 00:00:00 2001 From: Coke Date: Sun, 11 Jul 2010 11:01:40 -0400 Subject: [PATCH] [info args] complains if invoked a non-proc. --- src/Partcl/commands/info.pm | 6 +++++- t/cmd_info.t | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Partcl/commands/info.pm b/src/Partcl/commands/info.pm index dc97ba9..53687d8 100644 --- a/src/Partcl/commands/info.pm +++ b/src/Partcl/commands/info.pm @@ -102,7 +102,11 @@ our sub dispatch_command(*@args) { } my sub args($procname) { - pir::getprop__PsP('args', pir::get_hll_global__PS($procname)); + my $sub := pir::get_hll_global__PS($procname); + error("\"$procname\" isn't a procedure") + if pir::isnull($sub); + + pir::getprop__PsP('args', $sub); } my sub body($procname) { diff --git a/t/cmd_info.t b/t/cmd_info.t index e66dad2..467ba1d 100755 --- a/t/cmd_info.t +++ b/t/cmd_info.t @@ -36,7 +36,7 @@ eval_is { catch {rename me ""} eval_is { info args me -} {"me" isn't a procedure} {info args no proc} {TODO NQPRX} +} {"me" isn't a procedure} {info args no proc} eval_is { proc foo {a {b 2}} {puts a; puts b}