File "variables.js"
Full path: /usr/home/mndrn/domains/mndrn.ru/public_html/block-hill/blockly/generators/javascript/variables.js
File size: 917 B
MIME-type: text/plain
Charset: utf-8
/**
* @license
* Copyright 2012 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Generating JavaScript for variable blocks.
* @author [email protected] (Neil Fraser)
*/
'use strict';
goog.provide('Blockly.JavaScript.variables');
goog.require('Blockly.JavaScript');
Blockly.JavaScript['variables_get'] = function(block) {
// Variable getter.
var code = Blockly.JavaScript.variableDB_.getName(block.getFieldValue('VAR'),
Blockly.VARIABLE_CATEGORY_NAME);
return [code, Blockly.JavaScript.ORDER_ATOMIC];
};
Blockly.JavaScript['variables_set'] = function(block) {
// Variable setter.
var argument0 = Blockly.JavaScript.valueToCode(block, 'VALUE',
Blockly.JavaScript.ORDER_ASSIGNMENT) || '0';
var varName = Blockly.JavaScript.variableDB_.getName(
block.getFieldValue('VAR'), Blockly.VARIABLE_CATEGORY_NAME);
return varName + ' = ' + argument0 + ';\n';
};