File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -145,8 +145,18 @@ function Get-Turtle {
145
145
) {
146
146
# If we have arguments,
147
147
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
+
150
160
} else {
151
161
# otherwise, just invoke the method with no arguments.
152
162
$currentTurtle .$currentMember.Invoke ()
You can’t perform that action at this time.
0 commit comments