123456789101112131415161718192021 |
- 'use strict';
- goog.provide('Blockly.Python.tuple');
- goog.require('Blockly.Python');
- Blockly.Python['tuple_create'] = function(block) {
- // Create a list with any number of elements of any type.
- var elements = new Array(block.itemCount_);
- for (var i = 0; i < block.itemCount_; i++) {
- elements[i] = (Blockly.Python.valueToCode(block, 'ADD' + i,
- Blockly.Python.ORDER_NONE) || '___' );
- }
- var code = elements.join(', ');
- if (block.itemCount_ == 1) {
- code = '(' + code + ',)';
- } else {
- code = '(' + code + ')';
- }
- return [code, Blockly.Python.ORDER_ATOMIC];
- }
|