File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,8 +145,18 @@ function Get-Turtle {
145145 ) {
146146 # If we have arguments,
147147 if ($argList ) {
148- # pass them to the method.
149- $currentTurtle .$currentMember.Invoke ($argList )
148+ # and we have a script method
149+ if ($memberInfo -is [Management.Automation.Runspaces.ScriptMethodData ]) {
150+ # set this to the current turtle
151+ $this = $currentTurtle
152+ # and call the script, splatting positional parameters
153+ # (this allows more complex binding, like ValueFromRemainingArguments)
154+ . $currentTurtle .$currentMember.Script @argList
155+ } else {
156+ # Otherwise, we pass the parameters directly to the method
157+ $currentTurtle .$currentMember.Invoke ($argList )
158+ }
159+
150160 } else {
151161 # otherwise, just invoke the method with no arguments.
152162 $currentTurtle .$currentMember.Invoke ()
You can’t perform that action at this time.
0 commit comments