mirror of
https://github.com/google/blockly.git
synced 2026-05-08 21:20:12 +02:00
Merge branch 'develop' into ts/migration
Merge performed using the command
git merge -X rename-threshold=5% develop
to ensure that all renames were successfully detected.
This commit is contained in:
@@ -78,7 +78,6 @@
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"Blockly": true,
|
||||
"goog": true,
|
||||
"exports": true
|
||||
},
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.libraryBlocks');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const colour = goog.require('Blockly.libraryBlocks.colour');
|
||||
const lists = goog.require('Blockly.libraryBlocks.lists');
|
||||
|
||||
-176
@@ -15,7 +15,6 @@
|
||||
* @namespace Blockly
|
||||
*/
|
||||
goog.module('Blockly');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const ContextMenu = goog.require('Blockly.ContextMenu');
|
||||
const ContextMenuItems = goog.require('Blockly.ContextMenuItems');
|
||||
@@ -349,135 +348,6 @@ exports.setParentContainer = common.setParentContainer;
|
||||
* Anything in this section may be removed in a future version of Blockly.
|
||||
*/
|
||||
|
||||
// Add accessors for properties on Blockly that have now been deprecated.
|
||||
Object.defineProperties(exports, {
|
||||
/**
|
||||
* Wrapper to window.alert() that app developers may override to
|
||||
* provide alternatives to the modal browser window.
|
||||
* @name Blockly.alert
|
||||
* @type {!function(string, function()=)}
|
||||
* @deprecated Use Blockly.dialog.alert / .setAlert() instead.
|
||||
* (December 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
alert: {
|
||||
set: function(newAlert) {
|
||||
deprecation.warn('Blockly.alert', 'December 2021', 'December 2022');
|
||||
dialog.setAlert(newAlert);
|
||||
},
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.alert', 'December 2021', 'December 2022',
|
||||
'Blockly.dialog.alert()');
|
||||
return dialog.alert;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Wrapper to window.confirm() that app developers may override to
|
||||
* provide alternatives to the modal browser window.
|
||||
* @name Blockly.confirm
|
||||
* @type {!function(string, function()=)}
|
||||
* @deprecated Use Blockly.dialog.confirm / .setConfirm() instead.
|
||||
* (December 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
confirm: {
|
||||
set: function(newConfirm) {
|
||||
deprecation.warn('Blockly.confirm', 'December 2021', 'December 2022');
|
||||
dialog.setConfirm(newConfirm);
|
||||
},
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.confirm', 'December 2021', 'December 2022',
|
||||
'Blockly.dialog.confirm()');
|
||||
return dialog.confirm;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The main workspace most recently used.
|
||||
* Set by Blockly.WorkspaceSvg.prototype.markFocused
|
||||
* @name Blockly.mainWorkspace
|
||||
* @type {Workspace}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
mainWorkspace: {
|
||||
set: function(x) {
|
||||
common.setMainWorkspace(x);
|
||||
},
|
||||
get: function() {
|
||||
return common.getMainWorkspace();
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Wrapper to window.prompt() that app developers may override to
|
||||
* provide alternatives to the modal browser window. Built-in
|
||||
* browser prompts are often used for better text input experience
|
||||
* on mobile device. We strongly recommend testing mobile when
|
||||
* overriding this.
|
||||
* @name Blockly.prompt
|
||||
* @type {!function(string, string, function()=)}
|
||||
* @deprecated Use Blockly.dialog.prompt / .setPrompt() instead.
|
||||
* (December 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
prompt: {
|
||||
set: function(newPrompt) {
|
||||
deprecation.warn('Blockly.prompt', 'December 2021', 'December 2022');
|
||||
dialog.setPrompt(newPrompt);
|
||||
},
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.prompt', 'December 2021', 'December 2022',
|
||||
'Blockly.dialog.prompt()');
|
||||
return dialog.prompt;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Currently selected block.
|
||||
* @name Blockly.selected
|
||||
* @type {?ICopyable}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
selected: {
|
||||
get: function() {
|
||||
return common.getSelected();
|
||||
},
|
||||
set: function(newSelection) {
|
||||
common.setSelected(newSelection);
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The richness of block colours, regardless of the hue.
|
||||
* Must be in the range of 0 (inclusive) to 1 (exclusive).
|
||||
* @name Blockly.HSV_SATURATION
|
||||
* @type {number}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
HSV_SATURATION: {
|
||||
get: function() {
|
||||
return utils.colour.getHsvSaturation();
|
||||
},
|
||||
set: function(newValue) {
|
||||
utils.colour.setHsvSaturation(newValue);
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The intensity of block colours, regardless of the hue.
|
||||
* Must be in the range of 0 (inclusive) to 1 (exclusive).
|
||||
* @name Blockly.HSV_VALUE
|
||||
* @type {number}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
HSV_VALUE: {
|
||||
get: function() {
|
||||
return utils.colour.getHsvValue();
|
||||
},
|
||||
set: function(newValue) {
|
||||
utils.colour.setHsvValue(newValue);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the dimensions of the specified SVG image.
|
||||
* @param {!SVGElement} svg SVG image.
|
||||
@@ -842,49 +712,3 @@ exports.thrasos = thrasos;
|
||||
exports.uiPosition = uiPosition;
|
||||
exports.utils = utils;
|
||||
exports.zelos = zelos;
|
||||
|
||||
// If Blockly is compiled with ADVANCED_COMPILATION and/or loaded as a
|
||||
// CJS or ES module there will not be a Blockly global variable
|
||||
// created. This can cause problems because a very common way of
|
||||
// loading translations is to use a <script> tag to load one of
|
||||
// msg/js/*.js, which consists of lines like:
|
||||
//
|
||||
// Blockly.Msg["ADD_COMMENT"] = "Add Comment";
|
||||
// Blockly.Msg["CLEAN_UP"] = "Clean up Blocks";
|
||||
//
|
||||
// This obviously only works if Blockly.Msg is the Msg export from the
|
||||
// Blockly.Msg module - so make sure it is, but only if there is not
|
||||
// yet a Blockly global variable.
|
||||
if (!('Blockly' in globalThis)) {
|
||||
globalThis['Blockly'] = {'Msg': Msg};
|
||||
}
|
||||
|
||||
// Temporary hack to copy accessor properties from exports to the
|
||||
// global Blockly object as the routine to copy exports in
|
||||
// goog.exportPath_ (see closure/goog/base.js) invoked by
|
||||
// declareLegacyNamespace only copies normal data properties, not
|
||||
// accessors. This can be removed once all remaining calls to
|
||||
// declareLegacyNamspace have been removed.
|
||||
//
|
||||
// This is only needed in uncompiled mode (see
|
||||
// google/blockly-samples#902); in compiled mode the exports object is
|
||||
// already the value of globalThis['Blockly'].
|
||||
//
|
||||
// Note that this code will still attempt to redefine accessors on a
|
||||
// previously-imported copy of the Blockly library if both are
|
||||
// imported in uncompiled mode. This will fail with TypeError as the
|
||||
// accessors are nonconfigurable (which is good, as otherwise one
|
||||
// accessors on one copy would call get/set functions on the other
|
||||
// copy!)
|
||||
/* eslint-disable-next-line no-undef */
|
||||
if (!COMPILED && typeof globalThis['Blockly'] === 'object' &&
|
||||
globalThis['Blockly'] !== exports) {
|
||||
const descriptors = Object.getOwnPropertyDescriptors(exports);
|
||||
const accessors = {};
|
||||
for (const key in descriptors) {
|
||||
if (descriptors[key].get || descriptors[key].set) {
|
||||
accessors[key] = descriptors[key];
|
||||
}
|
||||
}
|
||||
Object.defineProperties(globalThis['Blockly'], accessors);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import {MenuItem} from './menuitem.js';
|
||||
import {Msg} from './msg.js';
|
||||
import * as aria from './utils/aria.js';
|
||||
import {Coordinate} from './utils/coordinate.js';
|
||||
import * as deprecation from './utils/deprecation.js';
|
||||
import * as dom from './utils/dom.js';
|
||||
import {Rect} from './utils/rect.js';
|
||||
import * as svgMath from './utils/svg_math.js';
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
import * as goog from '../../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.Events');
|
||||
|
||||
import * as deprecation from '../utils/deprecation.js';
|
||||
|
||||
import {Abstract as AbstractEvent} from './events_abstract.js';
|
||||
import {BlockBase} from './events_block_base.js';
|
||||
import {BlockChange} from './events_block_change.js';
|
||||
@@ -120,4 +118,4 @@ export const getRecordUndo = eventUtils.getRecordUndo;
|
||||
export const isEnabled = eventUtils.isEnabled;
|
||||
export const setGroup = eventUtils.setGroup;
|
||||
export const setRecordUndo = eventUtils.setRecordUndo;
|
||||
export const disableOrphans = eventUtils.disableOrphans;
|
||||
export const disableOrphans = eventUtils.disableOrphans;
|
||||
|
||||
+2
-2
@@ -529,12 +529,12 @@ Object.defineProperties(Generator.prototype, {
|
||||
/** @return Name database. */
|
||||
get(this: Generator): Names |
|
||||
undefined {
|
||||
deprecation.warn('variableDB_', 'May 2021', 'May 2026', 'nameDB_');
|
||||
deprecation.warn('variableDB_', 'May 2021', 'September 2022', 'nameDB_');
|
||||
return this.nameDB_;
|
||||
},
|
||||
/** @param nameDb New name database. */
|
||||
set(this: Generator, nameDb: Names|undefined) {
|
||||
deprecation.warn('variableDB_', 'May 2021', 'May 2026', 'nameDB_');
|
||||
deprecation.warn('variableDB_', 'May 2021', 'September 2022', 'nameDB_');
|
||||
this.nameDB_ = nameDb;
|
||||
},
|
||||
}),
|
||||
|
||||
+291
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2022 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview The entrypoint for blockly_compressed.js. Provides
|
||||
* various backwards-compatibility hacks. Not used when loading
|
||||
* in uncompiled (uncompressed) mode via bootstrap.js.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.main');
|
||||
|
||||
const Blockly = goog.require('Blockly');
|
||||
const ContextMenu = goog.require('Blockly.ContextMenu');
|
||||
const Events = goog.require('Blockly.Events');
|
||||
const Msg = goog.require('Blockly.Msg');
|
||||
const Tooltip = goog.require('Blockly.Tooltip');
|
||||
const WidgetDiv = goog.require('Blockly.WidgetDiv');
|
||||
const colour = goog.require('Blockly.utils.colour');
|
||||
const common = goog.require('Blockly.common');
|
||||
const deprecation = goog.require('Blockly.utils.deprecation');
|
||||
const dialog = goog.require('Blockly.dialog');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
|
||||
/*
|
||||
* Aliased functions and properties that used to be on the Blockly namespace.
|
||||
* Everything in this section is deprecated. Both external and internal code
|
||||
* should avoid using these functions and use the designated replacements.
|
||||
* Everything in this section will be removed in a future version of Blockly.
|
||||
*/
|
||||
|
||||
// Add accessors for properties on Blockly that have now been deprecated.
|
||||
Object.defineProperties(Blockly, {
|
||||
/**
|
||||
* Wrapper to window.alert() that app developers may override to
|
||||
* provide alternatives to the modal browser window.
|
||||
* @name Blockly.alert
|
||||
* @type {!function(string, function()=)}
|
||||
* @deprecated Use Blockly.dialog.alert / .setAlert() instead.
|
||||
* (December 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
alert: {
|
||||
set: function(newAlert) {
|
||||
deprecation.warn('Blockly.alert', 'December 2021', 'December 2022');
|
||||
dialog.setAlert(newAlert);
|
||||
},
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.alert', 'December 2021', 'December 2022',
|
||||
'Blockly.dialog.alert()');
|
||||
return dialog.alert;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Wrapper to window.confirm() that app developers may override to
|
||||
* provide alternatives to the modal browser window.
|
||||
* @name Blockly.confirm
|
||||
* @type {!function(string, function()=)}
|
||||
* @deprecated Use Blockly.dialog.confirm / .setConfirm() instead.
|
||||
* (December 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
confirm: {
|
||||
set: function(newConfirm) {
|
||||
deprecation.warn('Blockly.confirm', 'December 2021', 'December 2022');
|
||||
dialog.setConfirm(newConfirm);
|
||||
},
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.confirm', 'December 2021', 'December 2022',
|
||||
'Blockly.dialog.confirm()');
|
||||
return dialog.confirm;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The main workspace most recently used.
|
||||
* Set by Blockly.WorkspaceSvg.prototype.markFocused
|
||||
* @name Blockly.mainWorkspace
|
||||
* @type {Workspace}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
mainWorkspace: {
|
||||
set: function(x) {
|
||||
common.setMainWorkspace(x);
|
||||
},
|
||||
get: function() {
|
||||
return common.getMainWorkspace();
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Wrapper to window.prompt() that app developers may override to
|
||||
* provide alternatives to the modal browser window. Built-in
|
||||
* browser prompts are often used for better text input experience
|
||||
* on mobile device. We strongly recommend testing mobile when
|
||||
* overriding this.
|
||||
* @name Blockly.prompt
|
||||
* @type {!function(string, string, function()=)}
|
||||
* @deprecated Use Blockly.dialog.prompt / .setPrompt() instead.
|
||||
* (December 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
prompt: {
|
||||
set: function(newPrompt) {
|
||||
deprecation.warn('Blockly.prompt', 'December 2021', 'December 2022');
|
||||
dialog.setPrompt(newPrompt);
|
||||
},
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.prompt', 'December 2021', 'December 2022',
|
||||
'Blockly.dialog.prompt()');
|
||||
return dialog.prompt;
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Currently selected block.
|
||||
* @name Blockly.selected
|
||||
* @type {?ICopyable}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
selected: {
|
||||
get: function() {
|
||||
return common.getSelected();
|
||||
},
|
||||
set: function(newSelection) {
|
||||
common.setSelected(newSelection);
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The richness of block colours, regardless of the hue.
|
||||
* Must be in the range of 0 (inclusive) to 1 (exclusive).
|
||||
* @name Blockly.HSV_SATURATION
|
||||
* @type {number}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
HSV_SATURATION: {
|
||||
get: function() {
|
||||
return colour.getHsvSaturation();
|
||||
},
|
||||
set: function(newValue) {
|
||||
colour.setHsvSaturation(newValue);
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The intensity of block colours, regardless of the hue.
|
||||
* Must be in the range of 0 (inclusive) to 1 (exclusive).
|
||||
* @name Blockly.HSV_VALUE
|
||||
* @type {number}
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
HSV_VALUE: {
|
||||
get: function() {
|
||||
return colour.getHsvValue();
|
||||
},
|
||||
set: function(newValue) {
|
||||
colour.setHsvValue(newValue);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Add accessors for properties on Blockly.ContextMenu that have now
|
||||
// been deprecated.
|
||||
Object.defineProperties(ContextMenu, {
|
||||
/**
|
||||
* Which block is the context menu attached to?
|
||||
* @name Blockly.ContextMenu.currentBlock
|
||||
* @type {Block}
|
||||
* @deprecated Use Blockly.Tooltip.getCurrentBlock() /
|
||||
* .setCurrentBlock() instead. (September 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
currentBlock: {
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.ContextMenu.currentBlock', 'September 2021',
|
||||
'September 2022', 'Blockly.Tooltip.getCurrentBlock()');
|
||||
return ContextMenu.getCurrentBlock();
|
||||
},
|
||||
set: function(block) {
|
||||
deprecation.warn(
|
||||
'Blockly.ContextMenu.currentBlock', 'September 2021',
|
||||
'September 2022', 'Blockly.Tooltip.setCurrentBlock(block)');
|
||||
ContextMenu.setCurrentBlock(block);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Add accessors for properties on Blockly.Events that have now been
|
||||
// deprecated.
|
||||
Object.defineProperties(Events, {
|
||||
/**
|
||||
* Sets whether the next event should be added to the undo stack.
|
||||
* @name Blockly.Evenents.recordUndo
|
||||
* @type {boolean}
|
||||
* @deprecated Use Blockly.Events.getRecordUndo() and
|
||||
* .setRecordUndo(). (September 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
recordUndo: {
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.Events.recordUndo', 'September 2021', 'September 2022',
|
||||
'Blockly.Events.getRecordUndo()');
|
||||
return eventUtils.getRecordUndo();
|
||||
},
|
||||
set: function(record) {
|
||||
deprecation.warn(
|
||||
'Blockly.Events.recordUndo', 'September 2021', 'September 2022',
|
||||
'Blockly.Events.setRecordUndo()');
|
||||
eventUtils.setRecordUndo(record);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// Add accessors for properties on Blockly.Tooltip that have now been
|
||||
// deprecated.
|
||||
Object.defineProperties(Tooltip, {
|
||||
/**
|
||||
* Is a tooltip currently showing?
|
||||
* @name Blockly.Tooltip.visible
|
||||
* @type {boolean}
|
||||
* @deprecated Use Blockly.Tooltip.isVisible() instead. (September
|
||||
* 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
visible: {
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.Tooltip.visible', 'September 2021', 'September 2022',
|
||||
'Blockly.Tooltip.isVisible()');
|
||||
return Tooltip.isVisible();
|
||||
},
|
||||
},
|
||||
/**
|
||||
* The HTML container. Set once by createDom.
|
||||
* @name Blockly.Tooltip.DIV
|
||||
* @type {HTMLDivElement}
|
||||
* @deprecated Use Blockly.Tooltip.getDiv() and .setDiv().
|
||||
* (September 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
DIV: {
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.Tooltip.DIV', 'September 2021', 'September 2022',
|
||||
'Blockly.Tooltip.getDiv()');
|
||||
return Tooltip.getDiv();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Add accessors for properties on Blockly.WidgetDiv that have now been
|
||||
// deprecated.
|
||||
Object.defineProperties(WidgetDiv, {
|
||||
/**
|
||||
* The HTML container for popup overlays (e.g. editor widgets).
|
||||
* @name Blockly.WidgetDiv.DIV
|
||||
* @type {?Element}
|
||||
* @deprecated Use Blockly.WidgetDiv.getDiv() and .setDiv().
|
||||
* (September 2021)
|
||||
* @suppress {checkTypes}
|
||||
*/
|
||||
DIV: {
|
||||
get: function() {
|
||||
deprecation.warn(
|
||||
'Blockly.WidgetDiv.DIV', 'September 2021', 'September 2022',
|
||||
'Blockly.WidgetDiv.getDiv()');
|
||||
return WidgetDiv.getDiv();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// If Blockly is compiled with ADVANCED_COMPILATION and/or loaded as a
|
||||
// CJS or ES module there will not be a Blockly global variable
|
||||
// created. This can cause problems because a very common way of
|
||||
// loading translations is to use a <script> tag to load one of
|
||||
// msg/js/*.js, which consists of lines like:
|
||||
//
|
||||
// Blockly.Msg["ADD_COMMENT"] = "Add Comment";
|
||||
// Blockly.Msg["CLEAN_UP"] = "Clean up Blocks";
|
||||
//
|
||||
// This obviously only works if Blockly.Msg is the Msg export from the
|
||||
// Blockly.Msg module - so make sure it is, but only if there is not
|
||||
// yet a Blockly global variable.
|
||||
if (!('Blockly' in globalThis)) {
|
||||
globalThis['Blockly'] = {'Msg': Msg};
|
||||
}
|
||||
@@ -142,6 +142,7 @@ export class Theme {
|
||||
* @return A new Blockly theme.
|
||||
*/
|
||||
static defineTheme(name: string, themeObj: AnyDuringMigration): Theme {
|
||||
name = name.toLowerCase();
|
||||
const theme = new Theme(name);
|
||||
let base = themeObj['base'];
|
||||
if (base) {
|
||||
|
||||
@@ -18,7 +18,6 @@ goog.declareModuleId('Blockly.Tooltip');
|
||||
|
||||
import * as browserEvents from './browser_events.js';
|
||||
import * as common from './common.js';
|
||||
import * as deprecation from './utils/deprecation.js';
|
||||
import * as blocklyString from './utils/string.js';
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import * as goog from '../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.WidgetDiv');
|
||||
|
||||
import * as common from './common.js';
|
||||
import * as deprecation from './utils/deprecation.js';
|
||||
import * as dom from './utils/dom.js';
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
import {Rect} from './utils/rect.js';
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.Dart');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
@@ -301,4 +300,4 @@ Dart.getAdjusted = function(block, atId, opt_delta, opt_negate,
|
||||
return at;
|
||||
};
|
||||
|
||||
exports = Dart;
|
||||
exports.dartGenerator = Dart;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
goog.module('Blockly.Dart.all');
|
||||
|
||||
const moduleExports = goog.require('Blockly.Dart');
|
||||
goog.require('Blockly.Dart.colour');
|
||||
goog.require('Blockly.Dart.lists');
|
||||
goog.require('Blockly.Dart.logic');
|
||||
@@ -23,3 +24,4 @@ goog.require('Blockly.Dart.texts');
|
||||
goog.require('Blockly.Dart.variables');
|
||||
goog.require('Blockly.Dart.variablesDynamic');
|
||||
|
||||
exports = moduleExports;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Dart.colour');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart.addReservedWords('Math');
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Dart.lists');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart.addReservedWords('Math');
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Dart.logic');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart['controls_if'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Dart.loops');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Dart.math');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart.addReservedWords('Math');
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Dart.procedures');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart['procedures_defreturn'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Dart.texts');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart.addReservedWords('Html,Math');
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Dart.variables');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
|
||||
|
||||
Dart['variables_get'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Dart.variablesDynamic');
|
||||
|
||||
const Dart = goog.require('Blockly.Dart');
|
||||
const {dartGenerator: Dart} = goog.require('Blockly.Dart');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.Dart.variables');
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.JavaScript');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
const objectUtils = goog.require('Blockly.utils.object');
|
||||
@@ -320,4 +319,4 @@ JavaScript.getAdjusted = function(
|
||||
return at;
|
||||
};
|
||||
|
||||
exports = JavaScript;
|
||||
exports.javascriptGenerator = JavaScript;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.all');
|
||||
|
||||
const moduleExports = goog.require('Blockly.JavaScript');
|
||||
goog.require('Blockly.JavaScript.colour');
|
||||
goog.require('Blockly.JavaScript.lists');
|
||||
goog.require('Blockly.JavaScript.logic');
|
||||
@@ -23,3 +24,4 @@ goog.require('Blockly.JavaScript.texts');
|
||||
goog.require('Blockly.JavaScript.variables');
|
||||
goog.require('Blockly.JavaScript.variablesDynamic');
|
||||
|
||||
exports = moduleExports;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.colour');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['colour_picker'] = function(block) {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.lists');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['lists_create_empty'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.logic');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['controls_if'] = function(block) {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
goog.module('Blockly.JavaScript.loops');
|
||||
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['controls_repeat_ext'] = function(block) {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.math');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['math_number'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.procedures');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['procedures_defreturn'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.texts');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.variables');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
|
||||
|
||||
JavaScript['variables_get'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.JavaScript.variablesDynamic');
|
||||
|
||||
const JavaScript = goog.require('Blockly.JavaScript');
|
||||
const {javascriptGenerator: JavaScript} = goog.require('Blockly.JavaScript');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.JavaScript.variables');
|
||||
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.Lua');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const objectUtils = goog.require('Blockly.utils.object');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
@@ -204,4 +203,4 @@ Lua.scrub_ = function(block, code, opt_thisOnly) {
|
||||
return commentCode + code + nextCode;
|
||||
};
|
||||
|
||||
exports = Lua;
|
||||
exports.luaGenerator = Lua;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
goog.module('Blockly.Lua.all');
|
||||
|
||||
const moduleExports = goog.require('Blockly.Lua');
|
||||
goog.require('Blockly.Lua.colour');
|
||||
goog.require('Blockly.Lua.lists');
|
||||
goog.require('Blockly.Lua.logic');
|
||||
@@ -23,3 +24,4 @@ goog.require('Blockly.Lua.texts');
|
||||
goog.require('Blockly.Lua.variables');
|
||||
goog.require('Blockly.Lua.variablesDynamic');
|
||||
|
||||
exports = moduleExports;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Lua.colour');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['colour_picker'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Lua.lists');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['lists_create_empty'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Lua.logic');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['controls_if'] = function(block) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.Lua.loops');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Lua.math');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['math_number'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Lua.procedures');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['procedures_defreturn'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Lua.texts');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['text'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Lua.variables');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Lua['variables_get'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Lua.variablesDynamic');
|
||||
|
||||
const Lua = goog.require('Blockly.Lua');
|
||||
const {luaGenerator: Lua} = goog.require('Blockly.Lua');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.Lua.variables');
|
||||
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.PHP');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const objectUtils = goog.require('Blockly.utils.object');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
@@ -301,4 +300,4 @@ PHP.getAdjusted = function(block, atId, opt_delta, opt_negate, opt_order) {
|
||||
return at;
|
||||
};
|
||||
|
||||
exports = PHP;
|
||||
exports.phpGenerator = PHP;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
goog.module('Blockly.PHP.all');
|
||||
|
||||
const moduleExports = goog.require('Blockly.PHP');
|
||||
goog.require('Blockly.PHP.colour');
|
||||
goog.require('Blockly.PHP.lists');
|
||||
goog.require('Blockly.PHP.logic');
|
||||
@@ -23,3 +24,4 @@ goog.require('Blockly.PHP.texts');
|
||||
goog.require('Blockly.PHP.variables');
|
||||
goog.require('Blockly.PHP.variablesDynamic');
|
||||
|
||||
exports = moduleExports;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.PHP.colour');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['colour_picker'] = function(block) {
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
|
||||
goog.module('Blockly.PHP.lists');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
PHP['lists_create_empty'] = function(block) {
|
||||
// Create an empty list.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.PHP.logic');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['controls_if'] = function(block) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.PHP.loops');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['controls_repeat_ext'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.PHP.math');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['math_number'] = function(block) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.PHP.procedures');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['procedures_defreturn'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.PHP.texts');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['text'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.PHP.variables');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
|
||||
|
||||
PHP['variables_get'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.PHP.variablesDynamic');
|
||||
|
||||
const PHP = goog.require('Blockly.PHP');
|
||||
const {phpGenerator: PHP} = goog.require('Blockly.PHP');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.PHP.variables');
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.Python');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
@@ -331,4 +330,4 @@ Python.getAdjustedInt = function(block, atId, opt_delta, opt_negate) {
|
||||
return at;
|
||||
};
|
||||
|
||||
exports = Python;
|
||||
exports.pythonGenerator = Python;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
goog.module('Blockly.Python.all');
|
||||
|
||||
const moduleExports = goog.require('Blockly.Python');
|
||||
goog.require('Blockly.Python.colour');
|
||||
goog.require('Blockly.Python.lists');
|
||||
goog.require('Blockly.Python.logic');
|
||||
@@ -23,3 +24,4 @@ goog.require('Blockly.Python.texts');
|
||||
goog.require('Blockly.Python.variables');
|
||||
goog.require('Blockly.Python.variablesDynamic');
|
||||
|
||||
exports = moduleExports;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Python.colour');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['colour_picker'] = function(block) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.Python.lists');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['lists_create_empty'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Python.logic');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['controls_if'] = function(block) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.Python.loops');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['controls_repeat_ext'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Python.math');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
// If any new block imports any library, add that library name here.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.Python.procedures');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const Variables = goog.require('Blockly.Variables');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['procedures_defreturn'] = function(block) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
goog.module('Blockly.Python.texts');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const stringUtils = goog.require('Blockly.utils.string');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['text'] = function(block) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
goog.module('Blockly.Python.variables');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const {NameType} = goog.require('Blockly.Names');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
Python['variables_get'] = function(block) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
goog.module('Blockly.Python.variablesDynamic');
|
||||
|
||||
const Python = goog.require('Blockly.Python');
|
||||
const {pythonGenerator: Python} = goog.require('Blockly.Python');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.Python.variables');
|
||||
|
||||
|
||||
Generated
+73
-100
@@ -38,7 +38,7 @@
|
||||
"http-server": "^14.0.0",
|
||||
"js-green-licenses": "^3.0.0",
|
||||
"json5": "^2.2.0",
|
||||
"mocha": "^9.1.1",
|
||||
"mocha": "^10.0.0",
|
||||
"readline-sync": "^1.4.10",
|
||||
"rimraf": "^3.0.2",
|
||||
"selenium-standalone": "^8.0.3",
|
||||
@@ -155,9 +155,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@blockly/block-test": {
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-2.0.11.tgz",
|
||||
"integrity": "sha512-gdziRa9OqKoK1Km+RV4CGZoFRkzCuDqGcpd9cXZXMPHGAAqTcJ0A9gjAoUQVgcwDsbjSXcAzEKuBSTpk4ThUhw==",
|
||||
"version": "2.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-2.0.12.tgz",
|
||||
"integrity": "sha512-xeTIavPB5Gin1F6AhYStmFvIolfYHq+1feNsil8rvQ5Ws0XYFrKyXz5+1Ws3T4+zr8mI4A84wp1kzXlIHQW52A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8.17.0"
|
||||
@@ -3167,9 +3167,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
@@ -3871,9 +3871,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.17.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz",
|
||||
"integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==",
|
||||
"version": "8.18.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz",
|
||||
"integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint/eslintrc": "^1.3.0",
|
||||
@@ -5478,15 +5478,6 @@
|
||||
"lodash": "^4.17.15"
|
||||
}
|
||||
},
|
||||
"node_modules/growl": {
|
||||
"version": "1.10.5",
|
||||
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
|
||||
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.x"
|
||||
}
|
||||
},
|
||||
"node_modules/gulp": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
|
||||
@@ -8178,48 +8169,55 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mocha": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz",
|
||||
"integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==",
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz",
|
||||
"integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@ungap/promise-all-settled": "1.1.2",
|
||||
"ansi-colors": "4.1.1",
|
||||
"browser-stdout": "1.3.1",
|
||||
"chokidar": "3.5.3",
|
||||
"debug": "4.3.3",
|
||||
"debug": "4.3.4",
|
||||
"diff": "5.0.0",
|
||||
"escape-string-regexp": "4.0.0",
|
||||
"find-up": "5.0.0",
|
||||
"glob": "7.2.0",
|
||||
"growl": "1.10.5",
|
||||
"he": "1.2.0",
|
||||
"js-yaml": "4.1.0",
|
||||
"log-symbols": "4.1.0",
|
||||
"minimatch": "4.2.1",
|
||||
"minimatch": "5.0.1",
|
||||
"ms": "2.1.3",
|
||||
"nanoid": "3.3.1",
|
||||
"nanoid": "3.3.3",
|
||||
"serialize-javascript": "6.0.0",
|
||||
"strip-json-comments": "3.1.1",
|
||||
"supports-color": "8.1.1",
|
||||
"which": "2.0.2",
|
||||
"workerpool": "6.2.0",
|
||||
"workerpool": "6.2.1",
|
||||
"yargs": "16.2.0",
|
||||
"yargs-parser": "20.2.4",
|
||||
"yargs-unparser": "2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"_mocha": "bin/_mocha",
|
||||
"mocha": "bin/mocha"
|
||||
"mocha": "bin/mocha.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
"node": ">= 14.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/mochajs"
|
||||
}
|
||||
},
|
||||
"node_modules/mocha/node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mocha/node_modules/diff": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
|
||||
@@ -8230,12 +8228,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mocha/node_modules/minimatch": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz",
|
||||
"integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
||||
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
"brace-expansion": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
@@ -8334,9 +8332,9 @@
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
|
||||
"integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==",
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
|
||||
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
@@ -9624,23 +9622,6 @@
|
||||
"node": ">=10.18.1"
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer-core/node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer-core/node_modules/devtools-protocol": {
|
||||
"version": "0.0.981744",
|
||||
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.981744.tgz",
|
||||
@@ -12486,9 +12467,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/workerpool": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz",
|
||||
"integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==",
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
|
||||
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
@@ -12901,9 +12882,9 @@
|
||||
}
|
||||
},
|
||||
"@blockly/block-test": {
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-2.0.11.tgz",
|
||||
"integrity": "sha512-gdziRa9OqKoK1Km+RV4CGZoFRkzCuDqGcpd9cXZXMPHGAAqTcJ0A9gjAoUQVgcwDsbjSXcAzEKuBSTpk4ThUhw==",
|
||||
"version": "2.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-2.0.12.tgz",
|
||||
"integrity": "sha512-xeTIavPB5Gin1F6AhYStmFvIolfYHq+1feNsil8rvQ5Ws0XYFrKyXz5+1Ws3T4+zr8mI4A84wp1kzXlIHQW52A==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
@@ -15300,9 +15281,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
|
||||
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
@@ -15871,9 +15852,9 @@
|
||||
}
|
||||
},
|
||||
"eslint": {
|
||||
"version": "8.17.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.17.0.tgz",
|
||||
"integrity": "sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==",
|
||||
"version": "8.18.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz",
|
||||
"integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@eslint/eslintrc": "^1.3.0",
|
||||
@@ -17132,12 +17113,6 @@
|
||||
"lodash": "^4.17.15"
|
||||
}
|
||||
},
|
||||
"growl": {
|
||||
"version": "1.10.5",
|
||||
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
|
||||
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
|
||||
"dev": true
|
||||
},
|
||||
"gulp": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
|
||||
@@ -19340,37 +19315,44 @@
|
||||
"dev": true
|
||||
},
|
||||
"mocha": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz",
|
||||
"integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==",
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz",
|
||||
"integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@ungap/promise-all-settled": "1.1.2",
|
||||
"ansi-colors": "4.1.1",
|
||||
"browser-stdout": "1.3.1",
|
||||
"chokidar": "3.5.3",
|
||||
"debug": "4.3.3",
|
||||
"debug": "4.3.4",
|
||||
"diff": "5.0.0",
|
||||
"escape-string-regexp": "4.0.0",
|
||||
"find-up": "5.0.0",
|
||||
"glob": "7.2.0",
|
||||
"growl": "1.10.5",
|
||||
"he": "1.2.0",
|
||||
"js-yaml": "4.1.0",
|
||||
"log-symbols": "4.1.0",
|
||||
"minimatch": "4.2.1",
|
||||
"minimatch": "5.0.1",
|
||||
"ms": "2.1.3",
|
||||
"nanoid": "3.3.1",
|
||||
"nanoid": "3.3.3",
|
||||
"serialize-javascript": "6.0.0",
|
||||
"strip-json-comments": "3.1.1",
|
||||
"supports-color": "8.1.1",
|
||||
"which": "2.0.2",
|
||||
"workerpool": "6.2.0",
|
||||
"workerpool": "6.2.1",
|
||||
"yargs": "16.2.0",
|
||||
"yargs-parser": "20.2.4",
|
||||
"yargs-unparser": "2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"diff": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
|
||||
@@ -19378,12 +19360,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz",
|
||||
"integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
||||
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
"brace-expansion": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
@@ -19466,9 +19448,9 @@
|
||||
"optional": true
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
|
||||
"integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==",
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
|
||||
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
|
||||
"dev": true
|
||||
},
|
||||
"nanomatch": {
|
||||
@@ -20476,15 +20458,6 @@
|
||||
"ws": "8.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"devtools-protocol": {
|
||||
"version": "0.0.981744",
|
||||
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.981744.tgz",
|
||||
@@ -22818,9 +22791,9 @@
|
||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ=="
|
||||
},
|
||||
"workerpool": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz",
|
||||
"integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==",
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
|
||||
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==",
|
||||
"dev": true
|
||||
},
|
||||
"wrap-ansi": {
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@
|
||||
"http-server": "^14.0.0",
|
||||
"js-green-licenses": "^3.0.0",
|
||||
"json5": "^2.2.0",
|
||||
"mocha": "^9.1.1",
|
||||
"mocha": "^10.0.0",
|
||||
"readline-sync": "^1.4.10",
|
||||
"rimraf": "^3.0.2",
|
||||
"selenium-standalone": "^8.0.3",
|
||||
|
||||
@@ -87,8 +87,14 @@ const NAMESPACE_PROPERTY = '__namespace__';
|
||||
* will be written to.
|
||||
* - .entry: the source .js file which is the entrypoint for the
|
||||
* chunk.
|
||||
* - .exports: an expression evaluating to the exports/Module object
|
||||
* of module that is the chunk's entrypoint / top level module.
|
||||
* - .reexport: if running in a browser, save the chunk's exports
|
||||
* object at this location in the global namespace.
|
||||
* object (or a single export of it; see reexportOnly, below) at
|
||||
* this location in the global namespace.
|
||||
* - .reexportOnly: if reexporting and this property is set,
|
||||
* save only the correspondingly-named export. Otherwise
|
||||
* save the whole export object.
|
||||
*
|
||||
* The function getChunkOptions will, after running
|
||||
* closure-calculate-chunks, update each chunk to add the following
|
||||
@@ -103,38 +109,50 @@ const NAMESPACE_PROPERTY = '__namespace__';
|
||||
const chunks = [
|
||||
{
|
||||
name: 'blockly',
|
||||
entry: path.join(CORE_DIR, 'blockly.js'),
|
||||
entry: path.join(CORE_DIR, 'main.js'),
|
||||
exports: 'module$exports$Blockly',
|
||||
reexport: 'Blockly',
|
||||
},
|
||||
{
|
||||
name: 'blocks',
|
||||
entry: 'blocks/blocks.js',
|
||||
exports: 'module$exports$Blockly$libraryBlocks',
|
||||
reexport: 'Blockly.libraryBlocks',
|
||||
},
|
||||
{
|
||||
name: 'javascript',
|
||||
entry: 'generators/javascript/all.js',
|
||||
exports: 'module$exports$Blockly$JavaScript',
|
||||
reexport: 'Blockly.JavaScript',
|
||||
reexportOnly: 'javascriptGenerator',
|
||||
},
|
||||
{
|
||||
name: 'python',
|
||||
entry: 'generators/python/all.js',
|
||||
exports: 'module$exports$Blockly$Python',
|
||||
reexport: 'Blockly.Python',
|
||||
reexportOnly: 'pythonGenerator',
|
||||
},
|
||||
{
|
||||
name: 'php',
|
||||
entry: 'generators/php/all.js',
|
||||
exports: 'module$exports$Blockly$PHP',
|
||||
reexport: 'Blockly.PHP',
|
||||
reexportOnly: 'phpGenerator',
|
||||
},
|
||||
{
|
||||
name: 'lua',
|
||||
entry: 'generators/lua/all.js',
|
||||
exports: 'module$exports$Blockly$Lua',
|
||||
reexport: 'Blockly.Lua',
|
||||
reexportOnly: 'luaGenerator',
|
||||
},
|
||||
{
|
||||
name: 'dart',
|
||||
entry: 'generators/dart/all.js',
|
||||
exports: 'module$exports$Blockly$Dart',
|
||||
reexport: 'Blockly.Dart',
|
||||
reexportOnly: 'dartGenerator',
|
||||
}
|
||||
];
|
||||
|
||||
@@ -339,7 +357,7 @@ function buildDeps(done) {
|
||||
| (grep -v '^WARNING in' ; true)`,
|
||||
{stdio: 'inherit'});
|
||||
done();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This task regenrates msg/json/en.js and msg/json/qqq.js from
|
||||
@@ -369,7 +387,7 @@ this removal!
|
||||
`);
|
||||
|
||||
done();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This task builds Blockly's lang files.
|
||||
@@ -395,7 +413,7 @@ function buildLangfiles(done) {
|
||||
execSync(createMessagesCmd, {stdio: 'inherit'});
|
||||
|
||||
done();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper method to return an closure compiler chunk wrapper that
|
||||
@@ -427,16 +445,20 @@ function chunkWrapper(chunk) {
|
||||
namespaceExpr = `${factoryArgs}.${NAMESPACE_PROPERTY}`;
|
||||
}
|
||||
|
||||
// Expression that evaluates the the value of the exports object for
|
||||
// the specified chunk. For now we guess the name that is created
|
||||
// by the module's goog.module.delcareLegacyNamespace call based on
|
||||
// chunk.reexport.
|
||||
const exportsExpression = `${NAMESPACE_VARIABLE}.${chunk.reexport}`;
|
||||
// In near future we might try to guess the internally-generated
|
||||
// name for the ES module's exports object.
|
||||
// const exportsExpression =
|
||||
// 'module$' + chunk.entry.replace(/\.m?js$/, '').replace(/\//g, '$');
|
||||
|
||||
// Code to assign the result of the factory function to the desired
|
||||
// export location when running in a browser. When
|
||||
// chunk.reexportOnly is set, this additionally does two other
|
||||
// things:
|
||||
// - It ensures that only the desired property of the exports object
|
||||
// is assigned to the specified reexport location.
|
||||
// - It ensures that the namesspace object is accessible via the
|
||||
// selected sub-object, so that any dependent modules can obtain
|
||||
// it.
|
||||
const browserExportStatements = chunk.reexportOnly ?
|
||||
`root.${chunk.reexport} = factoryExports.${chunk.reexportOnly};\n` +
|
||||
` root.${chunk.reexport}.${NAMESPACE_PROPERTY} = ` +
|
||||
`factoryExports.${NAMESPACE_PROPERTY};` :
|
||||
`root.${chunk.reexport} = factoryExports;`;
|
||||
|
||||
// Note that when loading in a browser the base of the exported path
|
||||
// (e.g. Blockly.blocks.all - see issue #5932) might not exist
|
||||
@@ -453,16 +475,16 @@ function chunkWrapper(chunk) {
|
||||
module.exports = factory(${cjsDepsExpr});
|
||||
} else { // Browser
|
||||
var factoryExports = factory(${browserDepsExpr});
|
||||
root.${chunk.reexport} = factoryExports;
|
||||
${browserExportStatements}
|
||||
}
|
||||
}(this, function(${factoryArgs}) {
|
||||
var ${NAMESPACE_VARIABLE}=${namespaceExpr};
|
||||
%output%
|
||||
${exportsExpression}.${NAMESPACE_PROPERTY}=${NAMESPACE_VARIABLE};
|
||||
return ${exportsExpression};
|
||||
${chunk.exports}.${NAMESPACE_PROPERTY}=${NAMESPACE_VARIABLE};
|
||||
return ${chunk.exports};
|
||||
}));
|
||||
`;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get chunking options to pass to Closure Compiler by using
|
||||
@@ -594,7 +616,10 @@ function compile(options) {
|
||||
// declared by base_minimal.js, while if you compile against
|
||||
// base.js instead you will discover that it uses @deprecated
|
||||
// inherits, forwardDeclare etc.
|
||||
hide_warnings_for: ['node_modules', 'build/src/closure/goog/goog.js'],
|
||||
hide_warnings_for: [
|
||||
'node_modules',
|
||||
path.join(TSC_OUTPUT_DIR, 'closure', 'goog', 'goog.js'),
|
||||
],
|
||||
define: ['COMPILED=true'],
|
||||
};
|
||||
if (argv.debug || argv.strict) {
|
||||
@@ -622,7 +647,13 @@ function buildCompiled() {
|
||||
// Closure Compiler options.
|
||||
const packageJson = getPackageJson(); // For version number.
|
||||
const options = {
|
||||
define: 'Blockly.VERSION="' + packageJson.version + '"',
|
||||
// The documentation for @define claims you can't use it on a
|
||||
// non-global, but the closure compiler turns everything in to a
|
||||
// global - you just have to know what the new name is! With
|
||||
// declareLegacyNamespace this was very straightforward. Without
|
||||
// it, we have to rely on implmentation details. See
|
||||
// https://github.com/google/closure-compiler/issues/1601#issuecomment-483452226
|
||||
define: `${chunks[0].exports}.VERSION='${packageJson.version}'`,
|
||||
chunk: chunkOptions.chunk,
|
||||
chunk_wrapper: chunkOptions.chunk_wrapper,
|
||||
rename_prefix_namespace: NAMESPACE_VARIABLE,
|
||||
@@ -639,7 +670,7 @@ function buildCompiled() {
|
||||
.pipe(
|
||||
gulp.sourcemaps.write('.', {includeContent: false, sourceRoot: './'}))
|
||||
.pipe(gulp.dest(BUILD_DIR));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This task builds Blockly core, blocks and generators together and uses
|
||||
@@ -699,7 +730,7 @@ function checkinBuilt() {
|
||||
`${BUILD_DIR}/*_compressed.js.map`,
|
||||
`${BUILD_DIR}/msg/js/*.js`,
|
||||
], {base: BUILD_DIR}).pipe(gulp.dest('.'));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This task cleans the build directory (by deleting it).
|
||||
@@ -722,7 +753,7 @@ function format() {
|
||||
], {base: '.'})
|
||||
.pipe(clangFormatter.format('file', clangFormat))
|
||||
.pipe(gulp.dest('.'));
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
prepare: prepare,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"chunk": [
|
||||
"blockly:259",
|
||||
"blocks:10:blockly",
|
||||
"all:11:blockly",
|
||||
"all1:11:blockly",
|
||||
"all2:11:blockly",
|
||||
"all3:11:blockly",
|
||||
"all4:11:blockly"
|
||||
"main:260",
|
||||
"blocks:10:main",
|
||||
"all:11:main",
|
||||
"all1:11:main",
|
||||
"all2:11:main",
|
||||
"all3:11:main",
|
||||
"all4:11:main"
|
||||
],
|
||||
"js": [
|
||||
"./build/src/core/inject.js",
|
||||
@@ -128,6 +128,7 @@
|
||||
"./build/src/core/menu.js",
|
||||
"./build/src/core/field_dropdown.js",
|
||||
"./build/src/core/workspace_audio.js",
|
||||
"./build/src/core/utils/keycodes.js",
|
||||
"./build/src/core/utils.js",
|
||||
"./build/src/core/drag_target.js",
|
||||
"./build/src/core/delete_area.js",
|
||||
@@ -195,7 +196,6 @@
|
||||
"./build/src/core/events/events_block_drag.js",
|
||||
"./build/src/core/block_dragger.js",
|
||||
"./build/src/core/gesture.js",
|
||||
"./build/src/core/utils/keycodes.js",
|
||||
"./build/src/core/shortcut_registry.js",
|
||||
"./build/src/core/field.js",
|
||||
"./build/src/core/field_label.js",
|
||||
@@ -266,8 +266,9 @@
|
||||
"./build/src/core/connection_type.js",
|
||||
"./build/src/core/blocks.js",
|
||||
"./build/src/core/common.js",
|
||||
"./build/src/closure/goog/base_minimal.js",
|
||||
"./build/src/core/blockly.js",
|
||||
"./build/src/closure/goog/base_minimal.js",
|
||||
"./build/src/core/main.js",
|
||||
"./blocks/variables_dynamic.js",
|
||||
"./blocks/variables.js",
|
||||
"./blocks/text.js",
|
||||
@@ -286,8 +287,8 @@
|
||||
"./generators/javascript/loops.js",
|
||||
"./generators/javascript/logic.js",
|
||||
"./generators/javascript/lists.js",
|
||||
"./generators/javascript.js",
|
||||
"./generators/javascript/colour.js",
|
||||
"./generators/javascript.js",
|
||||
"./generators/javascript/all.js",
|
||||
"./generators/python/variables_dynamic.js",
|
||||
"./generators/python/variables.js",
|
||||
@@ -297,8 +298,8 @@
|
||||
"./generators/python/loops.js",
|
||||
"./generators/python/logic.js",
|
||||
"./generators/python/lists.js",
|
||||
"./generators/python.js",
|
||||
"./generators/python/colour.js",
|
||||
"./generators/python.js",
|
||||
"./generators/python/all.js",
|
||||
"./generators/php/variables_dynamic.js",
|
||||
"./generators/php/variables.js",
|
||||
@@ -308,8 +309,8 @@
|
||||
"./generators/php/loops.js",
|
||||
"./generators/php/logic.js",
|
||||
"./generators/php/lists.js",
|
||||
"./generators/php.js",
|
||||
"./generators/php/colour.js",
|
||||
"./generators/php.js",
|
||||
"./generators/php/all.js",
|
||||
"./generators/lua/variables_dynamic.js",
|
||||
"./generators/lua/variables.js",
|
||||
@@ -319,8 +320,8 @@
|
||||
"./generators/lua/loops.js",
|
||||
"./generators/lua/logic.js",
|
||||
"./generators/lua/lists.js",
|
||||
"./generators/lua.js",
|
||||
"./generators/lua/colour.js",
|
||||
"./generators/lua.js",
|
||||
"./generators/lua/all.js",
|
||||
"./generators/dart/variables_dynamic.js",
|
||||
"./generators/dart/variables.js",
|
||||
@@ -330,8 +331,8 @@
|
||||
"./generators/dart/loops.js",
|
||||
"./generators/dart/logic.js",
|
||||
"./generators/dart/lists.js",
|
||||
"./generators/dart.js",
|
||||
"./generators/dart/colour.js",
|
||||
"./generators/dart.js",
|
||||
"./generators/dart/all.js"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1342,6 +1342,31 @@
|
||||
'oldName': 'Blockly.utils.global',
|
||||
'newPath': 'globalThis',
|
||||
},
|
||||
{
|
||||
oldName: 'Blockly.Dart',
|
||||
newExport: 'dartGenerator',
|
||||
newPath: 'Blockly.Dart',
|
||||
},
|
||||
{
|
||||
oldName: 'Blockly.JavaScript',
|
||||
newExport: 'javascriptGenerator',
|
||||
newPath: 'Blockly.JavaScript',
|
||||
},
|
||||
{
|
||||
oldName: 'Blockly.Lua',
|
||||
newExport: 'luaGenerator',
|
||||
newPath: 'Blockly.Lua',
|
||||
},
|
||||
{
|
||||
oldName: 'Blockly.PHP',
|
||||
newExport: 'phpGenerator',
|
||||
newPath: 'Blockly.php',
|
||||
},
|
||||
{
|
||||
oldName: 'Blockly.Python',
|
||||
newExport: 'pythonGenerator',
|
||||
newPath: 'Blockly.Python',
|
||||
},
|
||||
{
|
||||
'oldName': 'Blockly.ContextMenuRegistry',
|
||||
exports: {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"globals": {
|
||||
"Blockly": true,
|
||||
"dartGenerator": true,
|
||||
"javascriptGenerator": true,
|
||||
"luaGenerator": true,
|
||||
"phpGenerator": true,
|
||||
"pythonGenerator": true
|
||||
}
|
||||
}
|
||||
Vendored
+23
@@ -17,4 +17,27 @@
|
||||
/* eslint-disable-next-line no-undef */
|
||||
for (const require of window.bootstrapInfo.requires) {
|
||||
goog.require(require);
|
||||
|
||||
// If require is a top-level chunk, create a global variable for it.
|
||||
// This replaces the goog.module.declareLegacyNamespace calls that
|
||||
// previously existed in each chunk entrypoint.
|
||||
const exportName = {
|
||||
'Blockly.Dart': 'dartGenerator',
|
||||
'Blockly.Dart.all': 'dartGenerator',
|
||||
'Blockly.JavaScript': 'javascriptGenerator',
|
||||
'Blockly.JavaScript.all': 'javascriptGenerator',
|
||||
'Blockly.Lua': 'luaGenerator',
|
||||
'Blockly.Lua.all': 'luaGenerator',
|
||||
'Blockly.PHP': 'phpGenerator',
|
||||
'Blockly.PHP.all': 'phpGenerator',
|
||||
'Blockly.Python': 'pythonGenerator',
|
||||
'Blockly.Python.all': 'pythonGenerator',
|
||||
}[require];
|
||||
if (exportName) {
|
||||
window[exportName] = goog.module.get(require)[exportName];
|
||||
} else if (require === 'Blockly') {
|
||||
window.Blockly = goog.module.get(require);
|
||||
} else if (require === 'Blockly.libraryBlocks') {
|
||||
window.libraryBlocks = goog.module.get(require);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ goog.require('Blockly.libraryBlocks.math');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.libraryBlocks.texts');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.libraryBlocks.testBlocks');
|
||||
goog.require('testBlocks');
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.libraryBlocks.testBlocks');
|
||||
goog.module('testBlocks');
|
||||
|
||||
goog.require('Blockly');
|
||||
const Blockly = goog.require('Blockly');
|
||||
|
||||
Blockly.defineBlocksWithJsonArray([
|
||||
{
|
||||
|
||||
@@ -170,31 +170,31 @@ function toXml() {
|
||||
|
||||
function toJavaScript() {
|
||||
var code = '\'use strict\';\n\n'
|
||||
code += Blockly.JavaScript.workspaceToCode(demoWorkspace);
|
||||
code += javascriptGenerator.workspaceToCode(demoWorkspace);
|
||||
setOutput(code);
|
||||
outputCode = code;
|
||||
}
|
||||
|
||||
function toPython() {
|
||||
var code = Blockly.Python.workspaceToCode(demoWorkspace);
|
||||
var code = pythonGenerator.workspaceToCode(demoWorkspace);
|
||||
setOutput(code);
|
||||
outputCode = code;
|
||||
}
|
||||
|
||||
function toPhp() {
|
||||
var code = Blockly.PHP.workspaceToCode(demoWorkspace);
|
||||
var code = phpGenerator.workspaceToCode(demoWorkspace);
|
||||
setOutput(code);
|
||||
outputCode = code;
|
||||
}
|
||||
|
||||
function toLua() {
|
||||
var code = Blockly.Lua.workspaceToCode(demoWorkspace);
|
||||
var code = luaGenerator.workspaceToCode(demoWorkspace);
|
||||
setOutput(code);
|
||||
outputCode = code;
|
||||
}
|
||||
|
||||
function toDart() {
|
||||
var code = Blockly.Dart.workspaceToCode(demoWorkspace);
|
||||
var code = dartGenerator.workspaceToCode(demoWorkspace);
|
||||
setOutput(code);
|
||||
outputCode = code;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Blockly.Dart['unittest_main'] = function(block) {
|
||||
dartGenerator['unittest_main'] = function(block) {
|
||||
// Container for unit tests.
|
||||
var resultsVar = Blockly.Dart.nameDB_.getName('unittestResults',
|
||||
var resultsVar = dartGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.Dart.provideFunction_(
|
||||
var functionName = dartGenerator.provideFunction_(
|
||||
'unittest_report',
|
||||
[ 'String ' + Blockly.Dart.FUNCTION_NAME_PLACEHOLDER_ + '() {',
|
||||
[ 'String ' + dartGenerator.FUNCTION_NAME_PLACEHOLDER_ + '() {',
|
||||
' // Create test report.',
|
||||
' List report = [];',
|
||||
' StringBuffer summary = new StringBuffer();',
|
||||
@@ -50,7 +50,7 @@ Blockly.Dart['unittest_main'] = function(block) {
|
||||
block.getFieldValue('SUITE_NAME') +
|
||||
'\');\n';
|
||||
// Run tests (unindented).
|
||||
code += Blockly.Dart.statementToCode(block, 'DO')
|
||||
code += dartGenerator.statementToCode(block, 'DO')
|
||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||
// Print the report to the console (that's where errors will go anyway).
|
||||
code += 'print(' + functionName + '());\n';
|
||||
@@ -59,12 +59,12 @@ Blockly.Dart['unittest_main'] = function(block) {
|
||||
return code;
|
||||
};
|
||||
|
||||
Blockly.Dart['unittest_main'].defineAssert_ = function() {
|
||||
var resultsVar = Blockly.Dart.nameDB_.getName('unittestResults',
|
||||
dartGenerator['unittest_main'].defineAssert_ = function() {
|
||||
var resultsVar = dartGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.Dart.provideFunction_(
|
||||
var functionName = dartGenerator.provideFunction_(
|
||||
'unittest_assertequals',
|
||||
[ 'void ' + Blockly.Dart.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
[ 'void ' + dartGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'(dynamic actual, dynamic expected, String message) {',
|
||||
' // Asserts that a value equals another value.',
|
||||
' if (' + resultsVar + ' == null) {',
|
||||
@@ -96,24 +96,24 @@ Blockly.Dart['unittest_main'].defineAssert_ = function() {
|
||||
return functionName;
|
||||
};
|
||||
|
||||
Blockly.Dart['unittest_assertequals'] = function(block) {
|
||||
dartGenerator['unittest_assertequals'] = function(block) {
|
||||
// Asserts that a value equals another value.
|
||||
var message = Blockly.Dart.valueToCode(block, 'MESSAGE',
|
||||
Blockly.Dart.ORDER_NONE) || '';
|
||||
var actual = Blockly.Dart.valueToCode(block, 'ACTUAL',
|
||||
Blockly.Dart.ORDER_NONE) || 'null';
|
||||
var expected = Blockly.Dart.valueToCode(block, 'EXPECTED',
|
||||
Blockly.Dart.ORDER_NONE) || 'null';
|
||||
return Blockly.Dart['unittest_main'].defineAssert_() +
|
||||
var message = dartGenerator.valueToCode(block, 'MESSAGE',
|
||||
dartGenerator.ORDER_NONE) || '';
|
||||
var actual = dartGenerator.valueToCode(block, 'ACTUAL',
|
||||
dartGenerator.ORDER_NONE) || 'null';
|
||||
var expected = dartGenerator.valueToCode(block, 'EXPECTED',
|
||||
dartGenerator.ORDER_NONE) || 'null';
|
||||
return dartGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.Dart['unittest_assertvalue'] = function(block) {
|
||||
dartGenerator['unittest_assertvalue'] = function(block) {
|
||||
// Asserts that a value is true, false, or null.
|
||||
var message = Blockly.Dart.valueToCode(block, 'MESSAGE',
|
||||
Blockly.Dart.ORDER_NONE) || '';
|
||||
var actual = Blockly.Dart.valueToCode(block, 'ACTUAL',
|
||||
Blockly.Dart.ORDER_NONE) || 'null';
|
||||
var message = dartGenerator.valueToCode(block, 'MESSAGE',
|
||||
dartGenerator.ORDER_NONE) || '';
|
||||
var actual = dartGenerator.valueToCode(block, 'ACTUAL',
|
||||
dartGenerator.ORDER_NONE) || 'null';
|
||||
var expected = block.getFieldValue('EXPECTED');
|
||||
if (expected === 'TRUE') {
|
||||
expected = 'true';
|
||||
@@ -122,18 +122,18 @@ Blockly.Dart['unittest_assertvalue'] = function(block) {
|
||||
} else if (expected === 'NULL') {
|
||||
expected = 'null';
|
||||
}
|
||||
return Blockly.Dart['unittest_main'].defineAssert_() +
|
||||
return dartGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.Dart['unittest_fail'] = function(block) {
|
||||
dartGenerator['unittest_fail'] = function(block) {
|
||||
// Always assert an error.
|
||||
var resultsVar = Blockly.Dart.nameDB_.getName('unittestResults',
|
||||
var resultsVar = dartGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var message = Blockly.Dart.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = Blockly.Dart.provideFunction_(
|
||||
var message = dartGenerator.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = dartGenerator.provideFunction_(
|
||||
'unittest_fail',
|
||||
[ 'void ' + Blockly.Dart.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
[ 'void ' + dartGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'(String message) {',
|
||||
' // Always assert an error.',
|
||||
' if (' + resultsVar + ' == null) {',
|
||||
@@ -144,20 +144,20 @@ Blockly.Dart['unittest_fail'] = function(block) {
|
||||
return functionName + '(' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.Dart['unittest_adjustindex'] = function(block) {
|
||||
var index = Blockly.Dart.valueToCode(block, 'INDEX',
|
||||
Blockly.Dart.ORDER_ADDITIVE) || '0';
|
||||
dartGenerator['unittest_adjustindex'] = function(block) {
|
||||
var index = dartGenerator.valueToCode(block, 'INDEX',
|
||||
dartGenerator.ORDER_ADDITIVE) || '0';
|
||||
// Adjust index if using one-based indexing.
|
||||
if (block.workspace.options.oneBasedIndex) {
|
||||
if (Blockly.isNumber(index)) {
|
||||
// If the index is a naked number, adjust it right now.
|
||||
return [Number(index) + 1, Blockly.Dart.ORDER_ATOMIC];
|
||||
return [Number(index) + 1, dartGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
}
|
||||
} else if (Blockly.isNumber(index)) {
|
||||
return [index, Blockly.Dart.ORDER_ATOMIC];
|
||||
return [index, dartGenerator.ORDER_ATOMIC];
|
||||
}
|
||||
return [index, Blockly.Dart.ORDER_ADDITIVE];
|
||||
return [index, dartGenerator.ORDER_ADDITIVE];
|
||||
};
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Blockly.JavaScript['unittest_main'] = function(block) {
|
||||
javascriptGenerator['unittest_main'] = function(block) {
|
||||
// Container for unit tests.
|
||||
var resultsVar = Blockly.JavaScript.nameDB_.getName('unittestResults',
|
||||
var resultsVar = javascriptGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.JavaScript.provideFunction_(
|
||||
var functionName = javascriptGenerator.provideFunction_(
|
||||
'unittest_report',
|
||||
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ + '() {',
|
||||
[ 'function ' + javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_ + '() {',
|
||||
' // Create test report.',
|
||||
' var report = [];',
|
||||
' var summary = [];',
|
||||
@@ -51,7 +51,7 @@ Blockly.JavaScript['unittest_main'] = function(block) {
|
||||
block.getFieldValue('SUITE_NAME') +
|
||||
'\')\n';
|
||||
// Run tests (unindented).
|
||||
code += Blockly.JavaScript.statementToCode(block, 'DO')
|
||||
code += javascriptGenerator.statementToCode(block, 'DO')
|
||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||
// Send the report to the console (that's where errors will go anyway).
|
||||
code += 'console.log(' + functionName + '());\n';
|
||||
@@ -60,12 +60,12 @@ Blockly.JavaScript['unittest_main'] = function(block) {
|
||||
return code;
|
||||
};
|
||||
|
||||
Blockly.JavaScript['unittest_main'].defineAssert_ = function(block) {
|
||||
var resultsVar = Blockly.JavaScript.nameDB_.getName('unittestResults',
|
||||
javascriptGenerator['unittest_main'].defineAssert_ = function(block) {
|
||||
var resultsVar = javascriptGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.JavaScript.provideFunction_(
|
||||
var functionName = javascriptGenerator.provideFunction_(
|
||||
'assertEquals',
|
||||
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
[ 'function ' + javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'(actual, expected, message) {',
|
||||
' // Asserts that a value equals another value.',
|
||||
' if (!' + resultsVar + ') {',
|
||||
@@ -100,24 +100,24 @@ Blockly.JavaScript['unittest_main'].defineAssert_ = function(block) {
|
||||
return functionName;
|
||||
};
|
||||
|
||||
Blockly.JavaScript['unittest_assertequals'] = function(block) {
|
||||
javascriptGenerator['unittest_assertequals'] = function(block) {
|
||||
// Asserts that a value equals another value.
|
||||
var message = Blockly.JavaScript.valueToCode(block, 'MESSAGE',
|
||||
Blockly.JavaScript.ORDER_NONE) || '';
|
||||
var actual = Blockly.JavaScript.valueToCode(block, 'ACTUAL',
|
||||
Blockly.JavaScript.ORDER_NONE) || 'null';
|
||||
var expected = Blockly.JavaScript.valueToCode(block, 'EXPECTED',
|
||||
Blockly.JavaScript.ORDER_NONE) || 'null';
|
||||
return Blockly.JavaScript['unittest_main'].defineAssert_() +
|
||||
var message = javascriptGenerator.valueToCode(block, 'MESSAGE',
|
||||
javascriptGenerator.ORDER_NONE) || '';
|
||||
var actual = javascriptGenerator.valueToCode(block, 'ACTUAL',
|
||||
javascriptGenerator.ORDER_NONE) || 'null';
|
||||
var expected = javascriptGenerator.valueToCode(block, 'EXPECTED',
|
||||
javascriptGenerator.ORDER_NONE) || 'null';
|
||||
return javascriptGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.JavaScript['unittest_assertvalue'] = function(block) {
|
||||
javascriptGenerator['unittest_assertvalue'] = function(block) {
|
||||
// Asserts that a value is true, false, or null.
|
||||
var message = Blockly.JavaScript.valueToCode(block, 'MESSAGE',
|
||||
Blockly.JavaScript.ORDER_NONE) || '';
|
||||
var actual = Blockly.JavaScript.valueToCode(block, 'ACTUAL',
|
||||
Blockly.JavaScript.ORDER_NONE) || 'null';
|
||||
var message = javascriptGenerator.valueToCode(block, 'MESSAGE',
|
||||
javascriptGenerator.ORDER_NONE) || '';
|
||||
var actual = javascriptGenerator.valueToCode(block, 'ACTUAL',
|
||||
javascriptGenerator.ORDER_NONE) || 'null';
|
||||
var expected = block.getFieldValue('EXPECTED');
|
||||
if (expected === 'TRUE') {
|
||||
expected = 'true';
|
||||
@@ -126,18 +126,18 @@ Blockly.JavaScript['unittest_assertvalue'] = function(block) {
|
||||
} else if (expected === 'NULL') {
|
||||
expected = 'null';
|
||||
}
|
||||
return Blockly.JavaScript['unittest_main'].defineAssert_() +
|
||||
return javascriptGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.JavaScript['unittest_fail'] = function(block) {
|
||||
javascriptGenerator['unittest_fail'] = function(block) {
|
||||
// Always assert an error.
|
||||
var resultsVar = Blockly.JavaScript.nameDB_.getName('unittestResults',
|
||||
var resultsVar = javascriptGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var message = Blockly.JavaScript.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = Blockly.JavaScript.provideFunction_(
|
||||
var message = javascriptGenerator.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = javascriptGenerator.provideFunction_(
|
||||
'unittest_fail',
|
||||
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
[ 'function ' + javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'(message) {',
|
||||
' // Always assert an error.',
|
||||
' if (!' + resultsVar + ') {',
|
||||
@@ -148,20 +148,20 @@ Blockly.JavaScript['unittest_fail'] = function(block) {
|
||||
return functionName + '(' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.JavaScript['unittest_adjustindex'] = function(block) {
|
||||
var index = Blockly.JavaScript.valueToCode(block, 'INDEX',
|
||||
Blockly.JavaScript.ORDER_ADDITION) || '0';
|
||||
javascriptGenerator['unittest_adjustindex'] = function(block) {
|
||||
var index = javascriptGenerator.valueToCode(block, 'INDEX',
|
||||
javascriptGenerator.ORDER_ADDITION) || '0';
|
||||
// Adjust index if using one-based indexing.
|
||||
if (block.workspace.options.oneBasedIndex) {
|
||||
if (Blockly.isNumber(index)) {
|
||||
// If the index is a naked number, adjust it right now.
|
||||
return [Number(index) + 1, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
return [Number(index) + 1, javascriptGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
}
|
||||
} else if (Blockly.isNumber(index)) {
|
||||
return [index, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
return [index, javascriptGenerator.ORDER_ATOMIC];
|
||||
}
|
||||
return [index, Blockly.JavaScript.ORDER_ADDITION];
|
||||
return [index, javascriptGenerator.ORDER_ADDITION];
|
||||
};
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Blockly.Lua['unittest_main'] = function(block) {
|
||||
luaGenerator['unittest_main'] = function(block) {
|
||||
// Container for unit tests.
|
||||
var resultsVar = Blockly.Lua.nameDB_.getName('unittestResults',
|
||||
var resultsVar = luaGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.Lua.provideFunction_(
|
||||
var functionName = luaGenerator.provideFunction_(
|
||||
'unittest_report',
|
||||
['function ' + Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_ + '()',
|
||||
['function ' + luaGenerator.FUNCTION_NAME_PLACEHOLDER_ + '()',
|
||||
' -- Create test report.',
|
||||
' local report = {}',
|
||||
' local summary = {}',
|
||||
@@ -49,7 +49,7 @@ Blockly.Lua['unittest_main'] = function(block) {
|
||||
block.getFieldValue('SUITE_NAME') +
|
||||
'\')\n';
|
||||
// Run tests (unindented).
|
||||
code += Blockly.Lua.statementToCode(block, 'DO')
|
||||
code += luaGenerator.statementToCode(block, 'DO')
|
||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||
// Print the report.
|
||||
code += 'print(' + functionName + '())\n';
|
||||
@@ -58,12 +58,12 @@ Blockly.Lua['unittest_main'] = function(block) {
|
||||
return code;
|
||||
};
|
||||
|
||||
Blockly.Lua['unittest_main'].defineAssert_ = function(block) {
|
||||
var resultsVar = Blockly.Lua.nameDB_.getName('unittestResults',
|
||||
luaGenerator['unittest_main'].defineAssert_ = function(block) {
|
||||
var resultsVar = luaGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.Lua.provideFunction_(
|
||||
var functionName = luaGenerator.provideFunction_(
|
||||
'assertEquals',
|
||||
['function ' + Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
['function ' + luaGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'(actual, expected, message)',
|
||||
' -- Asserts that a value equals another value.',
|
||||
' assert(' + resultsVar + ' ~= nil, ' +
|
||||
@@ -106,24 +106,24 @@ Blockly.Lua['unittest_main'].defineAssert_ = function(block) {
|
||||
return functionName;
|
||||
};
|
||||
|
||||
Blockly.Lua['unittest_assertequals'] = function(block) {
|
||||
luaGenerator['unittest_assertequals'] = function(block) {
|
||||
// Asserts that a value equals another value.
|
||||
var message = Blockly.Lua.valueToCode(block, 'MESSAGE',
|
||||
Blockly.Lua.ORDER_NONE) || '';
|
||||
var actual = Blockly.Lua.valueToCode(block, 'ACTUAL',
|
||||
Blockly.Lua.ORDER_NONE) || 'nil';
|
||||
var expected = Blockly.Lua.valueToCode(block, 'EXPECTED',
|
||||
Blockly.Lua.ORDER_NONE) || 'nil';
|
||||
return Blockly.Lua['unittest_main'].defineAssert_() +
|
||||
var message = luaGenerator.valueToCode(block, 'MESSAGE',
|
||||
luaGenerator.ORDER_NONE) || '';
|
||||
var actual = luaGenerator.valueToCode(block, 'ACTUAL',
|
||||
luaGenerator.ORDER_NONE) || 'nil';
|
||||
var expected = luaGenerator.valueToCode(block, 'EXPECTED',
|
||||
luaGenerator.ORDER_NONE) || 'nil';
|
||||
return luaGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ')\n';
|
||||
};
|
||||
|
||||
Blockly.Lua['unittest_assertvalue'] = function(block) {
|
||||
luaGenerator['unittest_assertvalue'] = function(block) {
|
||||
// Asserts that a value is true, false, or null.
|
||||
var message = Blockly.Lua.valueToCode(block, 'MESSAGE',
|
||||
Blockly.Lua.ORDER_NONE) || '';
|
||||
var actual = Blockly.Lua.valueToCode(block, 'ACTUAL',
|
||||
Blockly.Lua.ORDER_NONE) || 'nil';
|
||||
var message = luaGenerator.valueToCode(block, 'MESSAGE',
|
||||
luaGenerator.ORDER_NONE) || '';
|
||||
var actual = luaGenerator.valueToCode(block, 'ACTUAL',
|
||||
luaGenerator.ORDER_NONE) || 'nil';
|
||||
var expected = block.getFieldValue('EXPECTED');
|
||||
if (expected == 'TRUE') {
|
||||
expected = 'true';
|
||||
@@ -132,18 +132,18 @@ Blockly.Lua['unittest_assertvalue'] = function(block) {
|
||||
} else if (expected == 'NULL') {
|
||||
expected = 'nil';
|
||||
}
|
||||
return Blockly.Lua.unittest_main.defineAssert_() +
|
||||
return luaGenerator.unittest_main.defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ')\n';
|
||||
};
|
||||
|
||||
Blockly.Lua['unittest_fail'] = function(block) {
|
||||
luaGenerator['unittest_fail'] = function(block) {
|
||||
// Always assert an error.
|
||||
var resultsVar = Blockly.Lua.nameDB_.getName('unittestResults',
|
||||
var resultsVar = luaGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var message = Blockly.Lua.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = Blockly.Lua.provideFunction_(
|
||||
var message = luaGenerator.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = luaGenerator.provideFunction_(
|
||||
'unittest_fail',
|
||||
['function ' + Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_ + '(message)',
|
||||
['function ' + luaGenerator.FUNCTION_NAME_PLACEHOLDER_ + '(message)',
|
||||
' -- Always assert an error.',
|
||||
' assert(' + resultsVar +
|
||||
' ~= nil, "Orphaned assert fail: " .. message)',
|
||||
@@ -153,13 +153,13 @@ Blockly.Lua['unittest_fail'] = function(block) {
|
||||
return functionName + '(' + message + ')\n';
|
||||
};
|
||||
|
||||
Blockly.Lua['unittest_adjustindex'] = function(block) {
|
||||
var index = Blockly.Lua.valueToCode(block, 'INDEX',
|
||||
Blockly.Lua.ORDER_ADDITIVE) || '0';
|
||||
luaGenerator['unittest_adjustindex'] = function(block) {
|
||||
var index = luaGenerator.valueToCode(block, 'INDEX',
|
||||
luaGenerator.ORDER_ADDITIVE) || '0';
|
||||
if (Blockly.isNumber(index)) {
|
||||
// If the index is a naked number, adjust it right now.
|
||||
return [Number(index) + 1, Blockly.Lua.ORDER_ATOMIC];
|
||||
return [Number(index) + 1, luaGenerator.ORDER_ATOMIC];
|
||||
}
|
||||
// If the index is dynamic, adjust it in code.
|
||||
return [index + ' + 1', Blockly.Lua.ORDER_ADDITIVE];
|
||||
return [index + ' + 1', luaGenerator.ORDER_ADDITIVE];
|
||||
};
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Blockly.PHP['unittest_main'] = function(block) {
|
||||
phpGenerator['unittest_main'] = function(block) {
|
||||
// Container for unit tests.
|
||||
var resultsVar = Blockly.PHP.nameDB_.getName('unittestResults',
|
||||
var resultsVar = phpGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.PHP.provideFunction_(
|
||||
var functionName = phpGenerator.provideFunction_(
|
||||
'unittest_report',
|
||||
[ 'function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ + '() {',
|
||||
[ 'function ' + phpGenerator.FUNCTION_NAME_PLACEHOLDER_ + '() {',
|
||||
' global ' + resultsVar + ';',
|
||||
' // Create test report.',
|
||||
' $report = array();',
|
||||
@@ -51,7 +51,7 @@ Blockly.PHP['unittest_main'] = function(block) {
|
||||
block.getFieldValue('SUITE_NAME') +
|
||||
'\\n");\n';
|
||||
// Run tests (unindented).
|
||||
code += Blockly.PHP.statementToCode(block, 'DO')
|
||||
code += phpGenerator.statementToCode(block, 'DO')
|
||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||
// Send the report to the console (that's where errors will go anyway).
|
||||
code += 'print(' + functionName + '());\n';
|
||||
@@ -60,12 +60,12 @@ Blockly.PHP['unittest_main'] = function(block) {
|
||||
return code;
|
||||
};
|
||||
|
||||
Blockly.PHP['unittest_main'].defineAssert_ = function(block) {
|
||||
var resultsVar = Blockly.PHP.nameDB_.getName('unittestResults',
|
||||
phpGenerator['unittest_main'].defineAssert_ = function(block) {
|
||||
var resultsVar = phpGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.PHP.provideFunction_(
|
||||
var functionName = phpGenerator.provideFunction_(
|
||||
'assertEquals',
|
||||
['function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
['function ' + phpGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'($actual, $expected, $message) {',
|
||||
' global ' + resultsVar + ';',
|
||||
' // Asserts that a value equals another value.',
|
||||
@@ -86,24 +86,24 @@ Blockly.PHP['unittest_main'].defineAssert_ = function(block) {
|
||||
return functionName;
|
||||
};
|
||||
|
||||
Blockly.PHP['unittest_assertequals'] = function(block) {
|
||||
phpGenerator['unittest_assertequals'] = function(block) {
|
||||
// Asserts that a value equals another value.
|
||||
var message = Blockly.PHP.valueToCode(block, 'MESSAGE',
|
||||
Blockly.PHP.ORDER_NONE) || '';
|
||||
var actual = Blockly.PHP.valueToCode(block, 'ACTUAL',
|
||||
Blockly.PHP.ORDER_NONE) || 'null';
|
||||
var expected = Blockly.PHP.valueToCode(block, 'EXPECTED',
|
||||
Blockly.PHP.ORDER_NONE) || 'null';
|
||||
return Blockly.PHP['unittest_main'].defineAssert_() +
|
||||
var message = phpGenerator.valueToCode(block, 'MESSAGE',
|
||||
phpGenerator.ORDER_NONE) || '';
|
||||
var actual = phpGenerator.valueToCode(block, 'ACTUAL',
|
||||
phpGenerator.ORDER_NONE) || 'null';
|
||||
var expected = phpGenerator.valueToCode(block, 'EXPECTED',
|
||||
phpGenerator.ORDER_NONE) || 'null';
|
||||
return phpGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.PHP['unittest_assertvalue'] = function(block) {
|
||||
phpGenerator['unittest_assertvalue'] = function(block) {
|
||||
// Asserts that a value is true, false, or null.
|
||||
var message = Blockly.PHP.valueToCode(block, 'MESSAGE',
|
||||
Blockly.PHP.ORDER_NONE) || '';
|
||||
var actual = Blockly.PHP.valueToCode(block, 'ACTUAL',
|
||||
Blockly.PHP.ORDER_NONE) || 'null';
|
||||
var message = phpGenerator.valueToCode(block, 'MESSAGE',
|
||||
phpGenerator.ORDER_NONE) || '';
|
||||
var actual = phpGenerator.valueToCode(block, 'ACTUAL',
|
||||
phpGenerator.ORDER_NONE) || 'null';
|
||||
var expected = block.getFieldValue('EXPECTED');
|
||||
if (expected == 'TRUE') {
|
||||
expected = 'true';
|
||||
@@ -112,18 +112,18 @@ Blockly.PHP['unittest_assertvalue'] = function(block) {
|
||||
} else if (expected == 'NULL') {
|
||||
expected = 'null';
|
||||
}
|
||||
return Blockly.PHP['unittest_main'].defineAssert_() +
|
||||
return phpGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.PHP['unittest_fail'] = function(block) {
|
||||
phpGenerator['unittest_fail'] = function(block) {
|
||||
// Always assert an error.
|
||||
var resultsVar = Blockly.PHP.nameDB_.getName('unittestResults',
|
||||
var resultsVar = phpGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var message = Blockly.PHP.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = Blockly.PHP.provideFunction_(
|
||||
var message = phpGenerator.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = phpGenerator.provideFunction_(
|
||||
'unittest_fail',
|
||||
[ 'function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
[ 'function ' + phpGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'($message) {',
|
||||
' global ' + resultsVar + ';',
|
||||
' // Always assert an error.',
|
||||
@@ -135,20 +135,20 @@ Blockly.PHP['unittest_fail'] = function(block) {
|
||||
return functionName + '(' + message + ');\n';
|
||||
};
|
||||
|
||||
Blockly.PHP['unittest_adjustindex'] = function(block) {
|
||||
var index = Blockly.PHP.valueToCode(block, 'INDEX',
|
||||
Blockly.PHP.ORDER_ADDITION) || '0';
|
||||
phpGenerator['unittest_adjustindex'] = function(block) {
|
||||
var index = phpGenerator.valueToCode(block, 'INDEX',
|
||||
phpGenerator.ORDER_ADDITION) || '0';
|
||||
// Adjust index if using one-based indexing.
|
||||
if (block.workspace.options.oneBasedIndex) {
|
||||
if (Blockly.isNumber(index)) {
|
||||
// If the index is a naked number, adjust it right now.
|
||||
return [Number(index) + 1, Blockly.PHP.ORDER_ATOMIC];
|
||||
return [Number(index) + 1, phpGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
}
|
||||
} else if (Blockly.isNumber(index)) {
|
||||
return [index, Blockly.PHP.ORDER_ATOMIC];
|
||||
return [index, phpGenerator.ORDER_ATOMIC];
|
||||
}
|
||||
return [index, Blockly.PHP.ORDER_ADDITION];
|
||||
return [index, phpGenerator.ORDER_ADDITION];
|
||||
};
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Blockly.Python['unittest_main'] = function(block) {
|
||||
pythonGenerator['unittest_main'] = function(block) {
|
||||
// Container for unit tests.
|
||||
var resultsVar = Blockly.Python.nameDB_.getName('unittestResults',
|
||||
var resultsVar = pythonGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.Python.provideFunction_(
|
||||
var functionName = pythonGenerator.provideFunction_(
|
||||
'unittest_report',
|
||||
['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '():',
|
||||
['def ' + pythonGenerator.FUNCTION_NAME_PLACEHOLDER_ + '():',
|
||||
' # Create test report.',
|
||||
' report = []',
|
||||
' summary = []',
|
||||
@@ -47,7 +47,7 @@ Blockly.Python['unittest_main'] = function(block) {
|
||||
block.getFieldValue('SUITE_NAME') +
|
||||
'\')\n';
|
||||
// Run tests (unindented).
|
||||
code += Blockly.Python.statementToCode(block, 'DO')
|
||||
code += pythonGenerator.statementToCode(block, 'DO')
|
||||
.replace(/^ /, '').replace(/\n /g, '\n');
|
||||
// Print the report.
|
||||
code += 'print(' + functionName + '())\n';
|
||||
@@ -56,12 +56,12 @@ Blockly.Python['unittest_main'] = function(block) {
|
||||
return code;
|
||||
};
|
||||
|
||||
Blockly.Python['unittest_main'].defineAssert_ = function() {
|
||||
var resultsVar = Blockly.Python.nameDB_.getName('unittestResults',
|
||||
pythonGenerator['unittest_main'].defineAssert_ = function() {
|
||||
var resultsVar = pythonGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var functionName = Blockly.Python.provideFunction_(
|
||||
var functionName = pythonGenerator.provideFunction_(
|
||||
'assertEquals',
|
||||
['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
['def ' + pythonGenerator.FUNCTION_NAME_PLACEHOLDER_ +
|
||||
'(actual, expected, message):',
|
||||
' # Asserts that a value equals another value.',
|
||||
' if ' + resultsVar + ' == None:',
|
||||
@@ -74,24 +74,24 @@ Blockly.Python['unittest_main'].defineAssert_ = function() {
|
||||
return functionName;
|
||||
};
|
||||
|
||||
Blockly.Python['unittest_assertequals'] = function(block) {
|
||||
pythonGenerator['unittest_assertequals'] = function(block) {
|
||||
// Asserts that a value equals another value.
|
||||
var message = Blockly.Python.valueToCode(block, 'MESSAGE',
|
||||
Blockly.Python.ORDER_NONE) || '';
|
||||
var actual = Blockly.Python.valueToCode(block, 'ACTUAL',
|
||||
Blockly.Python.ORDER_NONE) || 'None';
|
||||
var expected = Blockly.Python.valueToCode(block, 'EXPECTED',
|
||||
Blockly.Python.ORDER_NONE) || 'None';
|
||||
return Blockly.Python['unittest_main'].defineAssert_() +
|
||||
var message = pythonGenerator.valueToCode(block, 'MESSAGE',
|
||||
pythonGenerator.ORDER_NONE) || '';
|
||||
var actual = pythonGenerator.valueToCode(block, 'ACTUAL',
|
||||
pythonGenerator.ORDER_NONE) || 'None';
|
||||
var expected = pythonGenerator.valueToCode(block, 'EXPECTED',
|
||||
pythonGenerator.ORDER_NONE) || 'None';
|
||||
return pythonGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ')\n';
|
||||
};
|
||||
|
||||
Blockly.Python['unittest_assertvalue'] = function(block) {
|
||||
pythonGenerator['unittest_assertvalue'] = function(block) {
|
||||
// Asserts that a value is true, false, or null.
|
||||
var message = Blockly.Python.valueToCode(block, 'MESSAGE',
|
||||
Blockly.Python.ORDER_NONE) || '';
|
||||
var actual = Blockly.Python.valueToCode(block, 'ACTUAL',
|
||||
Blockly.Python.ORDER_NONE) || 'None';
|
||||
var message = pythonGenerator.valueToCode(block, 'MESSAGE',
|
||||
pythonGenerator.ORDER_NONE) || '';
|
||||
var actual = pythonGenerator.valueToCode(block, 'ACTUAL',
|
||||
pythonGenerator.ORDER_NONE) || 'None';
|
||||
var expected = block.getFieldValue('EXPECTED');
|
||||
if (expected == 'TRUE') {
|
||||
expected = 'True';
|
||||
@@ -100,18 +100,18 @@ Blockly.Python['unittest_assertvalue'] = function(block) {
|
||||
} else if (expected == 'NULL') {
|
||||
expected = 'None';
|
||||
}
|
||||
return Blockly.Python['unittest_main'].defineAssert_() +
|
||||
return pythonGenerator['unittest_main'].defineAssert_() +
|
||||
'(' + actual + ', ' + expected + ', ' + message + ')\n';
|
||||
};
|
||||
|
||||
Blockly.Python['unittest_fail'] = function(block) {
|
||||
pythonGenerator['unittest_fail'] = function(block) {
|
||||
// Always assert an error.
|
||||
var resultsVar = Blockly.Python.nameDB_.getName('unittestResults',
|
||||
var resultsVar = pythonGenerator.nameDB_.getName('unittestResults',
|
||||
Blockly.Names.DEVELOPER_VARIABLE_TYPE);
|
||||
var message = Blockly.Python.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = Blockly.Python.provideFunction_(
|
||||
var message = pythonGenerator.quote_(block.getFieldValue('MESSAGE'));
|
||||
var functionName = pythonGenerator.provideFunction_(
|
||||
'fail',
|
||||
['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(message):',
|
||||
['def ' + pythonGenerator.FUNCTION_NAME_PLACEHOLDER_ + '(message):',
|
||||
' # Always assert an error.',
|
||||
' if ' + resultsVar + ' == None:',
|
||||
' raise Exception("Orphaned assert equals: " + message)',
|
||||
@@ -119,20 +119,20 @@ Blockly.Python['unittest_fail'] = function(block) {
|
||||
return functionName + '(' + message + ')\n';
|
||||
};
|
||||
|
||||
Blockly.Python['unittest_adjustindex'] = function(block) {
|
||||
var index = Blockly.Python.valueToCode(block, 'INDEX',
|
||||
Blockly.Python.ORDER_ADDITIVE) || '0';
|
||||
pythonGenerator['unittest_adjustindex'] = function(block) {
|
||||
var index = pythonGenerator.valueToCode(block, 'INDEX',
|
||||
pythonGenerator.ORDER_ADDITIVE) || '0';
|
||||
// Adjust index if using one-based indexing.
|
||||
if (block.workspace.options.oneBasedIndex) {
|
||||
if (Blockly.isNumber(index)) {
|
||||
// If the index is a naked number, adjust it right now.
|
||||
return [Number(index) + 1, Blockly.Python.ORDER_ATOMIC];
|
||||
return [Number(index) + 1, pythonGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
}
|
||||
} else if (Blockly.isNumber(index)) {
|
||||
return [index, Blockly.Python.ORDER_ATOMIC];
|
||||
return [index, pythonGenerator.ORDER_ATOMIC];
|
||||
}
|
||||
return [index, Blockly.Python.ORDER_ADDITIVE];
|
||||
return [index, pythonGenerator.ORDER_ADDITIVE];
|
||||
};
|
||||
|
||||
@@ -123,35 +123,35 @@ suite('Multiline Input Fields', function() {
|
||||
* @type {Array<CodeGenerationTestSuite>}
|
||||
*/
|
||||
const testSuites = [
|
||||
{title: 'Dart', generator: Blockly.Dart,
|
||||
{title: 'Dart', generator: dartGenerator,
|
||||
testCases: [
|
||||
{title: 'Empty string', expectedCode: '\'\'',
|
||||
createBlock: createBlockFn('')},
|
||||
{title: 'String with newline', expectedCode: '\'bark bark\' + \'\\n\' + \n\' bark bark bark\' + \'\\n\' + \n\' bark bar bark bark\' + \'\\n\' + \n\'\'',
|
||||
createBlock: createBlockFn('bark bark\n bark bark bark\n bark bar bark bark\n')},
|
||||
]},
|
||||
{title: 'JavaScript', generator: Blockly.JavaScript,
|
||||
{title: 'JavaScript', generator: javascriptGenerator,
|
||||
testCases: [
|
||||
{title: 'Empty string', expectedCode: '\'\'',
|
||||
createBlock: createBlockFn('')},
|
||||
{title: 'String with newline', expectedCode: '\'bark bark\' + \'\\n\' +\n\' bark bark bark\' + \'\\n\' +\n\' bark bar bark bark\' + \'\\n\' +\n\'\'',
|
||||
createBlock: createBlockFn('bark bark\n bark bark bark\n bark bar bark bark\n')},
|
||||
]},
|
||||
{title: 'Lua', generator: Blockly.Lua,
|
||||
{title: 'Lua', generator: luaGenerator,
|
||||
testCases: [
|
||||
{title: 'Empty string', expectedCode: '\'\'',
|
||||
createBlock: createBlockFn('')},
|
||||
{title: 'String with newline', expectedCode: '\'bark bark\' .. \'\\n\' ..\n\' bark bark bark\' .. \'\\n\' ..\n\' bark bar bark bark\' .. \'\\n\' ..\n\'\'',
|
||||
createBlock: createBlockFn('bark bark\n bark bark bark\n bark bar bark bark\n')},
|
||||
]},
|
||||
{title: 'PHP', generator: Blockly.PHP,
|
||||
{title: 'PHP', generator: phpGenerator,
|
||||
testCases: [
|
||||
{title: 'Empty string', expectedCode: '\'\'',
|
||||
createBlock: createBlockFn('')},
|
||||
{title: 'String with newline', expectedCode: '\'bark bark\' . "\\n" .\n\' bark bark bark\' . "\\n" .\n\' bark bar bark bark\' . "\\n" .\n\'\'',
|
||||
createBlock: createBlockFn('bark bark\n bark bark bark\n bark bar bark bark\n')},
|
||||
]},
|
||||
{title: 'Python', generator: Blockly.Python,
|
||||
{title: 'Python', generator: pythonGenerator,
|
||||
testCases: [
|
||||
{title: 'Empty string', expectedCode: '\'\'',
|
||||
createBlock: createBlockFn('')},
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
goog.module('Blockly.test.generator');
|
||||
|
||||
goog.require('Blockly.Dart');
|
||||
goog.require('Blockly.JavaScript');
|
||||
goog.require('Blockly.Lua');
|
||||
goog.require('Blockly.PHP');
|
||||
goog.require('Blockly.Python');
|
||||
const {dartGenerator} = goog.require('Blockly.Dart');
|
||||
const {javaScriptGenerator} = goog.require('Blockly.JavaScript');
|
||||
const {luaGenerator} = goog.require('Blockly.Lua');
|
||||
const {phpGenerator} = goog.require('Blockly.PHP');
|
||||
const {pythonGenerator} = goog.require('Blockly.Python');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
|
||||
|
||||
@@ -83,11 +83,11 @@ suite('Generator', function() {
|
||||
});
|
||||
|
||||
const testCase = [
|
||||
[Blockly.Dart, 'Dart'],
|
||||
[Blockly.JavaScript, 'JavaScript'],
|
||||
[Blockly.Lua, 'Lua'],
|
||||
[Blockly.PHP, 'PHP'],
|
||||
[Blockly.Python, 'Python']];
|
||||
[dartGenerator, 'Dart'],
|
||||
[javascriptGenerator, 'JavaScript'],
|
||||
[luaGenerator, 'Lua'],
|
||||
[phpGenerator, 'PHP'],
|
||||
[pythonGenerator, 'Python']];
|
||||
|
||||
suite('Trivial', function() {
|
||||
testCase.forEach(function(testCase) {
|
||||
|
||||
@@ -49,17 +49,17 @@ suite('InsertionMarkers', function() {
|
||||
});
|
||||
suite('Code Generation', function() {
|
||||
setup(function() {
|
||||
Blockly.JavaScript['stack_block'] = function(block) {
|
||||
javascriptGenerator['stack_block'] = function(block) {
|
||||
return 'stack[' + block.id + '];\n';
|
||||
};
|
||||
Blockly.JavaScript['row_block'] = function(block) {
|
||||
const value = Blockly.JavaScript
|
||||
.valueToCode(block, 'INPUT', Blockly.JavaScript.ORDER_NONE);
|
||||
javascriptGenerator['row_block'] = function(block) {
|
||||
const value = javascriptGenerator
|
||||
.valueToCode(block, 'INPUT', javascriptGenerator.ORDER_NONE);
|
||||
const code = 'row[' + block.id + '](' + value + ')';
|
||||
return [code, Blockly.JavaScript.ORDER_NONE];
|
||||
return [code, javascriptGenerator.ORDER_NONE];
|
||||
};
|
||||
Blockly.JavaScript['statement_block'] = function(block) {
|
||||
return 'statement[' + block.id + ']{\n' + Blockly.JavaScript
|
||||
javascriptGenerator['statement_block'] = function(block) {
|
||||
return 'statement[' + block.id + ']{\n' + javascriptGenerator
|
||||
.statementToCode(block, 'STATEMENT') + '};\n';
|
||||
};
|
||||
|
||||
@@ -67,14 +67,14 @@ suite('InsertionMarkers', function() {
|
||||
Blockly.Xml.domToWorkspace(xml, this.workspace);
|
||||
const block = this.workspace.getBlockById('insertion');
|
||||
block.isInsertionMarker_ = true;
|
||||
const code = Blockly.JavaScript.workspaceToCode(this.workspace);
|
||||
const code = javascriptGenerator.workspaceToCode(this.workspace);
|
||||
chai.assert.equal(code, expectedCode);
|
||||
};
|
||||
});
|
||||
teardown(function() {
|
||||
delete Blockly.JavaScript['stack_block'];
|
||||
delete Blockly.JavaScript['row_block'];
|
||||
delete Blockly.JavaScript['statement_block'];
|
||||
delete javascriptGenerator['stack_block'];
|
||||
delete javascriptGenerator['row_block'];
|
||||
delete javascriptGenerator['statement_block'];
|
||||
});
|
||||
test('Marker Surrounds', function() {
|
||||
const xml = Blockly.Xml.textToDom(
|
||||
|
||||
@@ -274,4 +274,11 @@ suite('Theme', function() {
|
||||
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
suite('defineTheme', function() {
|
||||
test('Normalizes to lowercase', function() {
|
||||
const theme = Blockly.Theme.defineTheme('TEST', {});
|
||||
chai.assert.equal(theme.name, 'test');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
const assert = require('chai').assert;
|
||||
const Blockly = require('../../dist/');
|
||||
const {javascriptGenerator} = require('../../dist/javascript');
|
||||
|
||||
const xmlText = '<xml xmlns="https://developers.google.com/blockly/xml">\n' +
|
||||
' <block type="text_print" x="37" y="63">\n' +
|
||||
@@ -48,7 +49,7 @@ suite('Test Node.js', function() {
|
||||
Blockly.Xml.domToWorkspace(xml, workspace);
|
||||
|
||||
// Convert code
|
||||
const code = Blockly.JavaScript.workspaceToCode(workspace);
|
||||
const code = javascriptGenerator.workspaceToCode(workspace);
|
||||
|
||||
// Check output
|
||||
assert.equal('window.alert(\'Hello from Blockly!\');', code.trim(), 'equal');
|
||||
|
||||
@@ -184,8 +184,15 @@ function load() {
|
||||
}
|
||||
|
||||
function toCode(lang) {
|
||||
var generator = ({
|
||||
'JavaScript': javascriptGenerator,
|
||||
'Python': pythonGenerator,
|
||||
'PHP': phpGenerator,
|
||||
'Lua': luaGenerator,
|
||||
'Dart': dartGenerator,
|
||||
})[lang];
|
||||
var output = document.getElementById('importExport');
|
||||
output.value = Blockly[lang].workspaceToCode(workspace);
|
||||
output.value = generator.workspaceToCode(workspace);
|
||||
taChange();
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -25686,7 +25686,7 @@ declare module "core/inject" {
|
||||
* @return {!WorkspaceSvg} Newly created main workspace.
|
||||
* @alias Blockly.inject
|
||||
*/
|
||||
export function inject(container: Element | string, opt_options?: (() => void) | undefined): WorkspaceSvg;
|
||||
export function inject(container: Element | string, opt_options?: Object | undefined): WorkspaceSvg;
|
||||
import { WorkspaceSvg } from "core/workspace_svg";
|
||||
}
|
||||
declare module "core/blockly" {
|
||||
|
||||
Reference in New Issue
Block a user