Skip to content

Commit 436d1ed

Browse files
committed
Removed classMethodNames field, and clearClassMethodNames, addClassMethodName, and getClassMethodName methods from GeneratorContext.
Removed nameFieldValue parameter from ExtendedPythonGenerator.addClassMethodDefinition method.
1 parent 178dc39 commit 436d1ed

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

src/blocks/mrc_class_method_def.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export const pythonFromBlock = function (
421421
xfix2 +
422422
returnValue;
423423
code = generator.scrub_(block, code);
424-
generator.addClassMethodDefinition(block.getFieldValue('NAME'), funcName, code);
424+
generator.addClassMethodDefinition(funcName, code);
425425

426426
return '';
427-
}
427+
}

src/editor/extended_python_generator.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ export class ExtendedPythonGenerator extends PythonGenerator {
9797
/**
9898
* Add a class method definition.
9999
*/
100-
addClassMethodDefinition(nameFieldValue: string, methodName: string, code: string): void {
101-
this.context.addClassMethodName(nameFieldValue, methodName);
100+
addClassMethodDefinition(methodName: string, code: string): void {
102101
this.classMethods[methodName] = code;
103102
}
104103

src/editor/generator_context.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ export class GeneratorContext {
3333
// The exported blocks for the current module.
3434
private exportedBlocks: Block[] = [];
3535

36-
// Key is the mrc_class_method_def block's NAME field, value is the python method name.
37-
private classMethodNames: {[key: string]: string} = Object.create(null);
38-
3936
// Has mechanisms (ie, needs in init)
4037
private hasMechanisms = false;
4138

@@ -46,15 +43,14 @@ export class GeneratorContext {
4643

4744
clear(): void {
4845
this.clearExportedBlocks();
49-
this.clearClassMethodNames();
5046
this.hasMechanisms = false;
5147
}
48+
5249
setHasMechanism():void{
5350
this.hasMechanisms = true;
5451
}
5552
getHasMechanisms():boolean{
5653
return this.hasMechanisms;
57-
}
5854

5955
getClassName(): string {
6056
if (this.module.moduleType === commonStorage.MODULE_TYPE_PROJECT) {
@@ -101,21 +97,4 @@ export class GeneratorContext {
10197
getExportedBlocks(): Block[] {
10298
return this.exportedBlocks;
10399
}
104-
105-
clearClassMethodNames() {
106-
this.classMethodNames = Object.create(null);
107-
}
108-
109-
addClassMethodName(nameFieldValue: string, methodName: string) {
110-
if (nameFieldValue !== methodName) {
111-
this.classMethodNames[nameFieldValue] = methodName;
112-
}
113-
}
114-
115-
getClassMethodName(nameFieldValue: string): string | null {
116-
if (this.classMethodNames[nameFieldValue]) {
117-
return this.classMethodNames[nameFieldValue];
118-
}
119-
return nameFieldValue;
120-
}
121100
}

0 commit comments

Comments
 (0)