changeset 10245:65496daaf367 octave-forge

inpuParser: check for correct call to parse before starting it to avoid weird errors and print_usage
author carandraug
date Mon, 14 May 2012 07:19:05 +0000
parents cd808d3516dd
children ef97c9c3b853
files main/general/inst/@inputParser/subsref.m
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/main/general/inst/@inputParser/subsref.m	Mon May 14 07:10:59 2012 +0000
+++ b/main/general/inst/@inputParser/subsref.m	Mon May 14 07:19:05 2012 +0000
@@ -62,16 +62,16 @@
 ## ParamValue mixed with Switch. Any other order makes no sense
 function inPar = parse_args (inPar, idx)
 
-  ## make copy of ordered list of Parameters to keep the original intact and readable
-  inPar.copy = inPar.Parameters;
+  ## syntax is inPar.parse (arguments)
+  if ( numel(idx) != 2 || idx(2).type != '()' )
+    print_usage ("@inputParser/parse");
+  endif
 
   ## this makes it easier to read but may be memory instensive
   args = idx(2).subs;
 
-  ## syntax is inPar.parse (arguments)
-  if ( numel(idx) != 2 || idx(2).type != '()' )
-    print_usage ("@inputParser/parse");
-  endif
+  ## make copy of ordered list of Parameters to keep the original intact and readable
+  inPar.copy = inPar.Parameters;
 
   if ( numel (fieldnames (inPar.Required)) > numel (args) )
     error("%sNot enough arguments", inPar.FunctionName);