Skip to content

Commit

Permalink
fix: invalid Python code generated for constructor calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Apr 3, 2024
1 parent 778a33b commit 6fe97f4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import {
getParameters,
getPlaceholderByName,
getStatements,
isStatic,
Parameter,
streamBlockLambdaResults,
} from '../helpers/nodeProperties.js';
Expand Down Expand Up @@ -1017,7 +1018,7 @@ export class SafeDsPythonGenerator {
(parameter) => this.nodeMapper.callToParameterValue(expression, parameter)!,
);
// For a static function, the thisParam would be the class containing the function. We do not need to generate it in this case
const generateThisParam = !isSdsFunction(callable) || (!callable.isStatic && thisParam);
const generateThisParam = thisParam && isSdsFunction(callable) && !isStatic(callable);
const containsOptionalArgs = sortedArgs.some((arg) =>
Parameter.isOptional(this.nodeMapper.argumentToParameter(arg)),
);
Expand Down

0 comments on commit 6fe97f4

Please sign in to comment.