mirror of
https://github.com/google/blockly.git
synced 2026-03-10 15:20:16 +01:00
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:
committed by
GitHub
parent
b0a7c004a9
commit
68261e5dd9
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user