define.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @license Licensed under the Apache License, Version 2.0 (the "License"):
  3. * http://www.apache.org/licenses/LICENSE-2.0
  4. */
  5. /**
  6. * @fileoverview Generating Arduino code for variables blocks.
  7. */
  8. 'use strict';
  9. goog.provide('Blockly.Python.define');
  10. goog.require('Blockly.Python');
  11. Blockly.Python['define'] = function(block) {
  12. var defineINIT = Blockly.Python.valueToCode(block, 'define_init', Blockly.Python.ORDER_ATOMIC);
  13. var defineVAR = Blockly.Python.valueToCode(block, 'define_variable', Blockly.Python.ORDER_ATOMIC);
  14. // TODO: Assemble JavaScript into code variable.
  15. Blockly.Python.addDeclaration('define_init', '#define\t' + defineINIT + '\t' + defineVAR, false);
  16. var code = '';
  17. return code;
  18. };
  19. Blockly.Python['define_var'] = function(block) {
  20. var defVariable = Blockly.Python.valueToCode(block, 'define_variable', Blockly.Python.ORDER_ATOMIC);
  21. // TODO: Assemble JavaScript into code variable.
  22. var code = '';
  23. // TODO: Change ORDER_NONE to the correct strength.
  24. return [code, Blockly.Python.ORDER_NONE];
  25. };