mirror of
https://github.com/google/blockly.git
synced 2025-12-15 22:00:07 +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.Dart');
|
||||
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 {Names, NameType} = goog.require('Blockly.Names');
|
||||
const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
const {inputTypes} = goog.require('Blockly.inputTypes');
|
||||
@@ -23,9 +23,9 @@ const {inputTypes} = goog.require('Blockly.inputTypes');
|
||||
|
||||
/**
|
||||
* Dart code generator.
|
||||
* @type {!Generator}
|
||||
* @type {!CodeGenerator}
|
||||
*/
|
||||
const Dart = new Generator('Dart');
|
||||
const Dart = new CodeGenerator('Dart');
|
||||
|
||||
/**
|
||||
* List of illegal variable names.
|
||||
@@ -86,7 +86,7 @@ Dart.isInitialized = false;
|
||||
* @param {!Workspace} workspace Workspace to generate code from.
|
||||
*/
|
||||
Dart.init = function(workspace) {
|
||||
// Call Blockly.Generator's init.
|
||||
// Call Blockly.CodeGenerator's init.
|
||||
Object.getPrototypeOf(this).init.call(this);
|
||||
|
||||
if (!this.nameDB_) {
|
||||
@@ -145,7 +145,7 @@ Dart.finish = function(code) {
|
||||
definitions.push(def);
|
||||
}
|
||||
}
|
||||
// Call Blockly.Generator's finish.
|
||||
// Call Blockly.CodeGenerator's finish.
|
||||
code = Object.getPrototypeOf(this).finish.call(this, code);
|
||||
this.isInitialized = false;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ goog.module('Blockly.Lua');
|
||||
|
||||
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} = goog.require('Blockly.Names');
|
||||
const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
@@ -23,9 +23,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
|
||||
/**
|
||||
* Lua code generator.
|
||||
* @type {!Generator}
|
||||
* @type {!CodeGenerator}
|
||||
*/
|
||||
const Lua = new Generator('Lua');
|
||||
const Lua = new CodeGenerator('Lua');
|
||||
|
||||
/**
|
||||
* List of illegal variable names.
|
||||
@@ -92,7 +92,7 @@ Lua.isInitialized = false;
|
||||
* @param {!Workspace} workspace Workspace to generate code from.
|
||||
*/
|
||||
Lua.init = function(workspace) {
|
||||
// Call Blockly.Generator's init.
|
||||
// Call Blockly.CodeGenerator's init.
|
||||
Object.getPrototypeOf(this).init.call(this);
|
||||
|
||||
if (!this.nameDB_) {
|
||||
@@ -115,7 +115,7 @@ Lua.init = function(workspace) {
|
||||
Lua.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;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ goog.module('Blockly.PHP');
|
||||
|
||||
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} = goog.require('Blockly.Names');
|
||||
const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
@@ -22,9 +22,9 @@ const {Workspace} = goog.requireType('Blockly.Workspace');
|
||||
|
||||
/**
|
||||
* PHP code generator.
|
||||
* @type {!Generator}
|
||||
* @type {!CodeGenerator}
|
||||
*/
|
||||
const PHP = new Generator('PHP');
|
||||
const PHP = new CodeGenerator('PHP');
|
||||
|
||||
/**
|
||||
* List of illegal variable names.
|
||||
@@ -130,7 +130,7 @@ PHP.isInitialized = false;
|
||||
* @param {!Workspace} workspace Workspace to generate code from.
|
||||
*/
|
||||
PHP.init = function(workspace) {
|
||||
// Call Blockly.Generator's init.
|
||||
// Call Blockly.CodeGenerator's init.
|
||||
Object.getPrototypeOf(this).init.call(this);
|
||||
|
||||
if (!this.nameDB_) {
|
||||
@@ -154,7 +154,7 @@ PHP.init = function(workspace) {
|
||||
PHP.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;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ goog.module('Blockly.Python');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
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');
|
||||
|
||||
/**
|
||||
* Python code generator.
|
||||
* @type {!Generator}
|
||||
* @type {!CodeGenerator}
|
||||
*/
|
||||
const Python = new Generator('Python');
|
||||
const Python = new CodeGenerator('Python');
|
||||
|
||||
/**
|
||||
* List of illegal variable names.
|
||||
@@ -137,10 +137,10 @@ Python.isInitialized = false;
|
||||
/**
|
||||
* Initialise the database of variable names.
|
||||
* @param {!Workspace} workspace Workspace to generate code from.
|
||||
* @this {Generator}
|
||||
* @this {CodeGenerator}
|
||||
*/
|
||||
Python.init = function(workspace) {
|
||||
// Call Blockly.Generator's init.
|
||||
// Call Blockly.CodeGenerator's init.
|
||||
Object.getPrototypeOf(this).init.call(this);
|
||||
|
||||
/**
|
||||
@@ -196,7 +196,7 @@ Python.finish = function(code) {
|
||||
definitions.push(def);
|
||||
}
|
||||
}
|
||||
// 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