Skip to content

Commit b495146

Browse files
committed
Fix passing the correct thing to superclass init
1 parent d363b10 commit b495146

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/blocks/mrc_class_method_def.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ export const pythonFromBlock = function (
458458
xfix2 = xfix1;
459459
}
460460
if(block.mrcPythonMethodName == '__init__'){
461-
branch = generator.INDENT + 'super().__init__()\n' +
461+
let class_specific = generator.getClassSpecificForInit();
462+
branch = generator.INDENT + 'super().__init__(' + class_specific + ')\n' +
462463
generator.defineClassVariables() + branch;
463464
}
464465
if (returnValue) {

src/editor/extended_python_generator.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,12 @@ export class ExtendedPythonGenerator extends PythonGenerator {
291291
setOpModeDetails(details : OpModeDetails) {
292292
this.details = details;
293293
}
294-
295-
getOpModeDetails() : OpModeDetails | null{
296-
return this.details;
294+
getClassSpecificForInit() : string{
295+
let classParent = this.context?.getClassParent();
296+
if (classParent == 'OpMode'){
297+
return 'robot'
298+
}
299+
return ''
297300
}
298301
}
299302

0 commit comments

Comments
 (0)