1234567891011121314151617181920 |
- 'use strict';
- goog.provide('Blockly.Python.dict');
- goog.require('Blockly.Python');
- Blockly.Python.dicts_create_with = function(block) {
- var value_keys = Blockly.Python.valueToCode(block, 'keys', Blockly. Python.ORDER_ATOMIC);
- // TODO: Assemble Python into code variable.
- var code = new Array(block.itemCount_);
-
- for (var n = 1; n <= block.itemCount_; n++) {
- var key = Blockly.Python.quote_(block.getFieldValue('KEY' + n));
- var value = Blockly.Python.valueToCode(block, 'VALUE' + n,
- Blockly.Python.ORDER_NONE) || '___';
- code[n-1] = key +": "+ value;
- }
- code = '{' + code.join(', ') + '}';
- return [code, Blockly.Python.ORDER_ATOMIC];
- };
|