Skip to content

Commit

Permalink
Remove positionalOnlyCall() override in StarlarkFunction - the Argume…
Browse files Browse the repository at this point in the history
…ntProcessor based default in StarlarkCallable should work perfectly now.

PiperOrigin-RevId: 720095256
Change-Id: I4a0dcaeb5d923e1cdd00e21324b758c7c7039589
  • Loading branch information
pzembrod authored and copybara-github committed Jan 27, 2025
1 parent 56bf547 commit 316de03
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/main/java/net/starlark/java/eval/StarlarkFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@ public Object fastcall(StarlarkThread thread, Object[] positional, Object[] name
return callWithArguments(thread, argumentProcessor);
}

@Override
public Object positionalOnlyCall(StarlarkThread thread, Object... positional)
throws EvalException, InterruptedException {
checkRecursive(thread);
FastcallArgumentProcessor argumentProcessor = new FastcallArgumentProcessor(this, thread);
// Feed only positional arguments into the argument processor.
argumentProcessor.processPositionalOnly(positional, thread.mutability());
return callWithArguments(thread, argumentProcessor);
}

@Override
public StarlarkCallable.ArgumentProcessor requestArgumentProcessor(StarlarkThread thread) {
return new ArgumentProcessor(this, thread);
Expand Down Expand Up @@ -505,17 +495,6 @@ void processPositionalAndNamed(Object[] positional, Object[] named, Mutability m
bindNamedArgsToLocals(named, mu);
}

void processPositionalOnly(Object[] positional, Mutability mu) throws EvalException {
numNonSurplusPositionalArgs = getNumNonSurplusPositionalArgs(positional);
bindPositionalArgsToLocals(positional);
bindSurplusPositionalArgsToVarArgs(positional);
// Bind an empty dict to **kwargs if present. (The dict, unfortunately, needs to be mutable;
// see https://github.com/bazelbuild/starlark/issues/295)
if (owner.rfn.hasKwargs()) {
locals[owner.rfn.getParameters().size() - 1] = Dict.of(mu);
}
}

/**
* Returns the number of positional arguments that should be bound to the function's positional
* parameters (in other words, excluding surplus positionals that get bound to {@code *args}).
Expand Down

0 comments on commit 316de03

Please sign in to comment.