mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
fix: Rename Generator to CodeGenerator (#6585)
Stops collisions with ES6's Generator. The old Blockly.Generator still exists as a name, but is now deprecated.
This commit is contained in:
@@ -15,7 +15,7 @@ goog.module('Blockly.JavaScript');
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {Block} = goog.requireType('Blockly.Block');
|
||||
const {Generator} = goog.require('Blockly.Generator');
|
||||
const {CodeGenerator} = goog.require('Blockly.CodeGenerator');
|
||||
const {inputTypes} = goog.require('Blockly.inputTypes');
|
||||
const {Names, NameType} = goog.require('Blockly.Names');
|
||||
const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
@@ -23,9 +23,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
|
||||
/**
|
||||
* JavaScript code generator.
|
||||
* @type {!Generator}
|
||||
* @type {!CodeGenerator}
|
||||
*/
|
||||
const JavaScript = new Generator('JavaScript');
|
||||
const JavaScript = new CodeGenerator('JavaScript');
|
||||
|
||||
/**
|
||||
* List of illegal variable names.
|
||||
@@ -127,7 +127,7 @@ JavaScript.isInitialized = false;
|
||||
* @param {!Workspace} workspace Workspace to generate code from.
|
||||
*/
|
||||
JavaScript.init = function(workspace) {
|
||||
// Call Blockly.Generator's init.
|
||||
// Call Blockly.CodeGenerator's init.
|
||||
Object.getPrototypeOf(this).init.call(this);
|
||||
|
||||
if (!this.nameDB_) {
|
||||
@@ -169,7 +169,7 @@ JavaScript.init = function(workspace) {
|
||||
JavaScript.finish = function(code) {
|
||||
// Convert the definitions dictionary into a list.
|
||||
const definitions = Object.values(this.definitions_);
|
||||
// Call Blockly.Generator's finish.
|
||||
// Call Blockly.CodeGenerator's finish.
|
||||
code = Object.getPrototypeOf(this).finish.call(this, code);
|
||||
this.isInitialized = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user