feat: add getVariableName and getProcedureName to CodeGenerator (#7445)

* feat: add getVariableName and getProcedureName to CodeGenerator

* feat: make nameDB_ public

* feat: update block code generators to use new APIs

* chore: fix build

* chore: remove unused imports
This commit is contained in:
Maribeth Bottorff
2023-08-31 10:49:17 -07:00
committed by GitHub
parent b0a7c004a9
commit 68261e5dd9
28 changed files with 122 additions and 109 deletions

View File

@@ -15,7 +15,7 @@ import * as stringUtils from '../../core/utils/string.js';
import * as Variables from '../../core/variables.js';
// import type {Block} from '../../core/block.js';
import {CodeGenerator} from '../../core/generator.js';
import {Names, NameType} from '../../core/names.js';
import {Names} from '../../core/names.js';
// import type {Workspace} from '../../core/workspace.js';
import {inputTypes} from '../../core/inputs/input_types.js';
@@ -179,7 +179,7 @@ export class PythonGenerator extends CodeGenerator {
const variables = Variables.allUsedVarModels(workspace);
for (let i = 0; i < variables.length; i++) {
defvars.push(
this.nameDB_.getName(variables[i].getId(), NameType.VARIABLE) +
this.getVariableName(variables[i].getId()) +
' = None');
}