Commit 154d9f12 authored by carlosperate's avatar carlosperate

Create built version of Arduino blocks and generator.

parent 6cd98de1
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.io'); goog.provide('Blockly.Blocks.io');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.io.HUE = 250; Blockly.Blocks.io.HUE = 250;
Blockly.Blocks['io_digitalwrite'] = { Blockly.Blocks['io_digitalwrite'] = {
/** /**
...@@ -25,7 +25,7 @@ Blockly.Blocks['io_digitalwrite'] = { ...@@ -25,7 +25,7 @@ Blockly.Blocks['io_digitalwrite'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite'); this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE); this.setColour(Blockly.Blocks.io.HUE);
this.appendValueInput('STATE') this.appendValueInput('STATE')
.appendField('set digital pin#') .appendField('set digital pin#')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -54,7 +54,7 @@ Blockly.Blocks['io_digitalread'] = { ...@@ -54,7 +54,7 @@ Blockly.Blocks['io_digitalread'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalRead'); this.setHelpUrl('http://arduino.cc/en/Reference/DigitalRead');
this.setColour(Blockly.Blocks.Arduino.io.HUE); this.setColour(Blockly.Blocks.io.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('read digital pin#') .appendField('read digital pin#')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -83,7 +83,7 @@ Blockly.Blocks['io_builtin_led'] = { ...@@ -83,7 +83,7 @@ Blockly.Blocks['io_builtin_led'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite'); this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE); this.setColour(Blockly.Blocks.io.HUE);
this.appendValueInput('STATE') this.appendValueInput('STATE')
.appendField('set LED') .appendField('set LED')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -116,7 +116,7 @@ Blockly.Blocks['io_analogwrite'] = { ...@@ -116,7 +116,7 @@ Blockly.Blocks['io_analogwrite'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/AnalogWrite'); this.setHelpUrl('http://arduino.cc/en/Reference/AnalogWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE); this.setColour(Blockly.Blocks.io.HUE);
this.appendValueInput('NUM') this.appendValueInput('NUM')
.appendField('set analogue pin#') .appendField('set analogue pin#')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -148,7 +148,7 @@ Blockly.Blocks['io_analogread'] = { ...@@ -148,7 +148,7 @@ Blockly.Blocks['io_analogread'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/AnalogRead'); this.setHelpUrl('http://arduino.cc/en/Reference/AnalogRead');
this.setColour(Blockly.Blocks.Arduino.io.HUE); this.setColour(Blockly.Blocks.io.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('read analogue pin#') .appendField('read analogue pin#')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -176,7 +176,7 @@ Blockly.Blocks['io_highlow'] = { ...@@ -176,7 +176,7 @@ Blockly.Blocks['io_highlow'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/Constants'); this.setHelpUrl('http://arduino.cc/en/Reference/Constants');
this.setColour(Blockly.Blocks.Arduino.io.HUE); this.setColour(Blockly.Blocks.io.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField( .appendField(
new Blockly.FieldDropdown([['HIGH', 'HIGH'], ['LOW', 'LOW']]), new Blockly.FieldDropdown([['HIGH', 'HIGH'], ['LOW', 'LOW']]),
......
/** /**
* @license Licensed under the Apache License, Version 2.0 (the "License"): * @license Licensed under the Apache License, Version 2.0 (the "License"):
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* */
/*
* @fileoverview Blocks use for the Ardublockly logo creation. * @fileoverview Blocks use for the Ardublockly logo creation.
* These are not mean to used at all. * These are not mean to used at all.
* *
* Generator:
* var noCode = function(block) { return ''; };
* Blockly.Arduino['ardublockly_name_bottom'] = noCode;
* Blockly.Arduino['ardublockly_plus_top_large'] = noCode;
* Blockly.Arduino['ardublockly_plus_top_small'] = noCode;
* Blockly.Arduino['ardublockly_plus_bottom_large'] = noCode;
* Blockly.Arduino['ardublockly_plus_bottom_small'] = noCode;
* Blockly.Arduino['ardublockly_plus_both_small'] = noCode;
* Blockly.Arduino['ardublockly_plus_both_large'] = noCode;
* Blockly.Arduino['ardublockly_minus_large'] = noCode;
* Blockly.Arduino['ardublockly_minus_small'] = noCode;
*
* Toolbox: * Toolbox:
* <sep></sep> * <sep></sep>
* <category name="Logo"> * <category name="Logo">
...@@ -20,15 +34,12 @@ ...@@ -20,15 +34,12 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.logo'); goog.provide('Blockly.Blocks.logo');
goog.require('Blockly.Arduino');
goog.require('Blockly.Blocks');
var noCode = function(block) { return ''; };
Blockly.Blocks.Arduino.variables.HUE = 180;
Blockly.Blocks.logo.HUE = 180;
/* Ardublockly block */ /* Ardublockly block */
Blockly.Blocks['ardublockly_name_top'] = { Blockly.Blocks['ardublockly_name_top'] = {
...@@ -36,22 +47,19 @@ Blockly.Blocks['ardublockly_name_top'] = { ...@@ -36,22 +47,19 @@ Blockly.Blocks['ardublockly_name_top'] = {
this.appendDummyInput() this.appendDummyInput()
.appendField("Ardublockly"); .appendField("Ardublockly");
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_name_top'] = noCode;
Blockly.Blocks['ardublockly_name_bottom'] = { Blockly.Blocks['ardublockly_name_bottom'] = {
init: function() { init: function() {
this.appendDummyInput() this.appendDummyInput()
.appendField("Ardublockly"); .appendField("Ardublockly");
this.setNextStatement(true); this.setNextStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
this.setTooltip(''); this.setTooltip('');
} }
}; };
Blockly.Arduino['ardublockly_name_bottom'] = noCode;
/* Plus block */ /* Plus block */
Blockly.Blocks['ardublockly_plus_top_large'] = { Blockly.Blocks['ardublockly_plus_top_large'] = {
...@@ -59,40 +67,36 @@ Blockly.Blocks['ardublockly_plus_top_large'] = { ...@@ -59,40 +67,36 @@ Blockly.Blocks['ardublockly_plus_top_large'] = {
this.appendValueInput("NAME") this.appendValueInput("NAME")
.appendField(" +"); .appendField(" +");
this.setNextStatement(true); this.setNextStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_plus_top_large'] = noCode;
Blockly.Blocks['ardublockly_plus_top_small'] = { Blockly.Blocks['ardublockly_plus_top_small'] = {
init: function() { init: function() {
this.appendValueInput("NAME") this.appendValueInput("NAME")
.appendField(" +"); .appendField(" +");
this.setNextStatement(true); this.setNextStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_plus_top_small'] = noCode;
Blockly.Blocks['ardublockly_plus_bottom_large'] = { Blockly.Blocks['ardublockly_plus_bottom_large'] = {
init: function() { init: function() {
this.appendValueInput("NAME") this.appendValueInput("NAME")
.appendField(" +"); .appendField(" +");
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_plus_bottom_large'] = noCode;
Blockly.Blocks['ardublockly_plus_bottom_small'] = { Blockly.Blocks['ardublockly_plus_bottom_small'] = {
init: function() { init: function() {
this.appendValueInput("NAME") this.appendValueInput("NAME")
.appendField(" +"); .appendField(" +");
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_plus_bottom_small'] = noCode;
Blockly.Blocks['ardublockly_plus_both_small'] = { Blockly.Blocks['ardublockly_plus_both_small'] = {
init: function() { init: function() {
...@@ -100,10 +104,9 @@ Blockly.Blocks['ardublockly_plus_both_small'] = { ...@@ -100,10 +104,9 @@ Blockly.Blocks['ardublockly_plus_both_small'] = {
.appendField(" +"); .appendField(" +");
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setNextStatement(true); this.setNextStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_plus_both_small'] = noCode;
Blockly.Blocks['ardublockly_plus_both_large'] = { Blockly.Blocks['ardublockly_plus_both_large'] = {
init: function() { init: function() {
...@@ -111,11 +114,9 @@ Blockly.Blocks['ardublockly_plus_both_large'] = { ...@@ -111,11 +114,9 @@ Blockly.Blocks['ardublockly_plus_both_large'] = {
.appendField(" +"); .appendField(" +");
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setNextStatement(true); this.setNextStatement(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_plus_both_large'] = noCode;
/* Minus block */ /* Minus block */
Blockly.Blocks['ardublockly_minus_large'] = { Blockly.Blocks['ardublockly_minus_large'] = {
...@@ -124,10 +125,9 @@ Blockly.Blocks['ardublockly_minus_large'] = { ...@@ -124,10 +125,9 @@ Blockly.Blocks['ardublockly_minus_large'] = {
.appendField("- "); .appendField("- ");
this.setInputsInline(false); this.setInputsInline(false);
this.setOutput(true); this.setOutput(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_minus_large'] = noCode;
Blockly.Blocks['ardublockly_minus_small'] = { Blockly.Blocks['ardublockly_minus_small'] = {
init: function() { init: function() {
...@@ -135,7 +135,6 @@ Blockly.Blocks['ardublockly_minus_small'] = { ...@@ -135,7 +135,6 @@ Blockly.Blocks['ardublockly_minus_small'] = {
.appendField("- "); .appendField("- ");
this.setInputsInline(false); this.setInputsInline(false);
this.setOutput(true); this.setOutput(true);
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.logo.HUE);
} }
}; };
Blockly.Arduino['ardublockly_minus_small'] = noCode;
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.map'); goog.provide('Blockly.Blocks.map');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.map.HUE = 230; Blockly.Blocks.map.HUE = 230;
Blockly.Blocks['base_map'] = { Blockly.Blocks['base_map'] = {
/** /**
...@@ -26,7 +26,7 @@ Blockly.Blocks['base_map'] = { ...@@ -26,7 +26,7 @@ Blockly.Blocks['base_map'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/map'); this.setHelpUrl('http://arduino.cc/en/Reference/map');
this.setColour(Blockly.Blocks.Arduino.map.HUE); this.setColour(Blockly.Blocks.map.HUE);
this.appendValueInput('NUM') this.appendValueInput('NUM')
.appendField('Map ') .appendField('Map ')
.setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles()); .setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles());
......
...@@ -10,13 +10,11 @@ ...@@ -10,13 +10,11 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.procedures'); goog.require('Blockly.Blocks');
goog.require('Blockly.Arduino');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.procedures.HUE = 290; Blockly.Blocks.procedures.HUE = 290;
Blockly.Blocks['arduino_functions'] = { Blockly.Blocks['arduino_functions'] = {
/** /**
...@@ -31,7 +29,7 @@ Blockly.Blocks['arduino_functions'] = { ...@@ -31,7 +29,7 @@ Blockly.Blocks['arduino_functions'] = {
.appendField('Arduino loop forever:'); .appendField('Arduino loop forever:');
this.appendStatementInput('LOOP_FUNC'); this.appendStatementInput('LOOP_FUNC');
this.setInputsInline(false); this.setInputsInline(false);
this.setColour(Blockly.Blocks.Arduino.procedures.HUE); this.setColour(Blockly.Blocks.procedures.HUE);
this.setTooltip('Defines the Arduino setup() and loop() functions.'); this.setTooltip('Defines the Arduino setup() and loop() functions.');
this.setHelpUrl('https://arduino.cc/en/Reference/Loop'); this.setHelpUrl('https://arduino.cc/en/Reference/Loop');
this.contextMenu = false; this.contextMenu = false;
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.serial'); goog.provide('Blockly.Blocks.serial');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.serial.HUE = 160; Blockly.Blocks.serial.HUE = 160;
Blockly.Blocks['serial_setup'] = { Blockly.Blocks['serial_setup'] = {
/** /**
...@@ -27,7 +27,7 @@ Blockly.Blocks['serial_setup'] = { ...@@ -27,7 +27,7 @@ Blockly.Blocks['serial_setup'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Serial/Begin'); this.setHelpUrl('http://arduino.cc/en/Serial/Begin');
this.setColour(Blockly.Blocks.Arduino.serial.HUE); this.setColour(Blockly.Blocks.serial.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('Setup') .appendField('Setup')
.appendField( .appendField(
...@@ -68,7 +68,7 @@ Blockly.Blocks['serial_print'] = { ...@@ -68,7 +68,7 @@ Blockly.Blocks['serial_print'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://www.arduino.cc/en/Serial/Print'); this.setHelpUrl('http://www.arduino.cc/en/Serial/Print');
this.setColour(Blockly.Blocks.Arduino.serial.HUE); this.setColour(Blockly.Blocks.serial.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.serial), 'SERIAL_ID') Blockly.Arduino.Boards.selected.serial), 'SERIAL_ID')
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.servo'); goog.provide('Blockly.Blocks.servo');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.servo.HUE = 60; Blockly.Blocks.servo.HUE = 60;
Blockly.Blocks['servo_write'] = { Blockly.Blocks['servo_write'] = {
/** /**
...@@ -26,7 +26,7 @@ Blockly.Blocks['servo_write'] = { ...@@ -26,7 +26,7 @@ Blockly.Blocks['servo_write'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/ServoWrite'); this.setHelpUrl('http://arduino.cc/en/Reference/ServoWrite');
this.setColour(Blockly.Blocks.Arduino.servo.HUE); this.setColour(Blockly.Blocks.servo.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('Set SERVO from Pin') .appendField('Set SERVO from Pin')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -59,7 +59,7 @@ Blockly.Blocks['servo_read'] = { ...@@ -59,7 +59,7 @@ Blockly.Blocks['servo_read'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/ServoRead'); this.setHelpUrl('http://arduino.cc/en/Reference/ServoRead');
this.setColour(Blockly.Blocks.Arduino.servo.HUE); this.setColour(Blockly.Blocks.servo.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('Read SERVO from PIN#') .appendField('Read SERVO from PIN#')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.spi'); goog.provide('Blockly.Blocks.spi');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.spi.HUE = 170; Blockly.Blocks.spi.HUE = 170;
Blockly.Blocks['spi_setup'] = { Blockly.Blocks['spi_setup'] = {
/** /**
...@@ -24,7 +24,7 @@ Blockly.Blocks['spi_setup'] = { ...@@ -24,7 +24,7 @@ Blockly.Blocks['spi_setup'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/SPI'); this.setHelpUrl('http://arduino.cc/en/Reference/SPI');
this.setColour(Blockly.Blocks.Arduino.spi.HUE); this.setColour(Blockly.Blocks.spi.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('Setup') .appendField('Setup')
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
...@@ -85,7 +85,7 @@ Blockly.Blocks['spi_transfer'] = { ...@@ -85,7 +85,7 @@ Blockly.Blocks['spi_transfer'] = {
Blockly.Arduino.Boards.selected.digitalPins); Blockly.Arduino.Boards.selected.digitalPins);
this.setHelpUrl('http://arduino.cc/en/Reference/SPITransfer'); this.setHelpUrl('http://arduino.cc/en/Reference/SPITransfer');
this.setColour(Blockly.Blocks.Arduino.spi.HUE); this.setColour(Blockly.Blocks.spi.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.spi), 'SPI_ID'); Blockly.Arduino.Boards.selected.spi), 'SPI_ID');
...@@ -182,7 +182,7 @@ Blockly.Blocks['spi_transfer_return'] = { ...@@ -182,7 +182,7 @@ Blockly.Blocks['spi_transfer_return'] = {
Blockly.Arduino.Boards.selected.digitalPins); Blockly.Arduino.Boards.selected.digitalPins);
this.setHelpUrl('http://arduino.cc/en/Reference/SPITransfer'); this.setHelpUrl('http://arduino.cc/en/Reference/SPITransfer');
this.setColour(Blockly.Blocks.Arduino.spi.HUE); this.setColour(Blockly.Blocks.spi.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField(new Blockly.FieldDropdown( .appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.spi), 'SPI_ID'); Blockly.Arduino.Boards.selected.spi), 'SPI_ID');
......
...@@ -8,34 +8,33 @@ ...@@ -8,34 +8,33 @@
* Additional functions apart from the normal generators have * Additional functions apart from the normal generators have
* been added to be able to generate the 'set' drop down menu * been added to be able to generate the 'set' drop down menu
* with all current instances of the Stepper class: * with all current instances of the Stepper class:
* Blockly.Blocks.Arduino.stepper.stepperInstances * Blockly.Blocks.stepper.stepperInstances
* Blockly.Blocks.Arduino.stepper.FieldStepperInstance * Blockly.Blocks.stepper.FieldStepperInstance
* Blockly.Blocks.Arduino.stepper.stepperDropdownList * Blockly.Blocks.stepper.stepperDropdownList
* *
* TODO: Still need to had some kind of handler to refresh the "set" drop down * TODO: Still need to had some kind of handler to refresh the "set" drop down
* menu values if an instance in a 'configure' block is renamed. * menu values if an instance in a 'configure' block is renamed.
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.stepper'); goog.provide('Blockly.Blocks.stepper');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
goog.require('Blockly.FieldDropdown');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.stepper.HUE = 80; Blockly.Blocks.stepper.HUE = 80;
/** Strings for easy reference. */ /** Strings for easy reference. */
Blockly.Blocks.Arduino.stepper.noInstance = 'No_Instances'; Blockly.Blocks.stepper.noInstance = 'No_Instances';
Blockly.Blocks.Arduino.stepper.noName = 'Empty_input_name'; Blockly.Blocks.stepper.noName = 'Empty_input_name';
/** /**
* Finds all user-created instances of the Stepper block config. * Finds all user-created instances of the Stepper block config.
* @return {!Array.<string>} Array of instance names. * @return {!Array.<string>} Array of instance names.
*/ */
Blockly.Blocks.Arduino.stepper.stepperInstances = function() { Blockly.Blocks.stepper.stepperInstances = function() {
var stepperList = []; var stepperList = [];
var blocks = Blockly.mainWorkspace.getTopBlocks(); var blocks = Blockly.mainWorkspace.getTopBlocks();
for (var x = 0; x < blocks.length; x++) { for (var x = 0; x < blocks.length; x++) {
...@@ -54,8 +53,8 @@ Blockly.Blocks.Arduino.stepper.stepperInstances = function() { ...@@ -54,8 +53,8 @@ Blockly.Blocks.Arduino.stepper.stepperInstances = function() {
* Return a sorted list of instances names for set dropdown menu. * Return a sorted list of instances names for set dropdown menu.
* @return {!Array.<string>} Array of stepper instances names. * @return {!Array.<string>} Array of stepper instances names.
*/ */
Blockly.Blocks.Arduino.stepper.stepperDropdownList = function() { Blockly.Blocks.stepper.stepperDropdownList = function() {
var stepperList = Blockly.Blocks.Arduino.stepper.stepperInstances(); var stepperList = Blockly.Blocks.stepper.stepperInstances();
var options = []; var options = [];
if (stepperList.length > 0) { if (stepperList.length > 0) {
stepperList.sort(goog.string.caseInsensitiveCompare); stepperList.sort(goog.string.caseInsensitiveCompare);
...@@ -66,8 +65,8 @@ Blockly.Blocks.Arduino.stepper.stepperDropdownList = function() { ...@@ -66,8 +65,8 @@ Blockly.Blocks.Arduino.stepper.stepperDropdownList = function() {
} }
} else { } else {
// There are no config blocks in the work area // There are no config blocks in the work area
options[0] = [Blockly.Blocks.Arduino.stepper.noInstance, options[0] = [Blockly.Blocks.stepper.noInstance,
Blockly.Blocks.Arduino.stepper.noInstance]; Blockly.Blocks.stepper.noInstance];
} }
return options; return options;
}; };
...@@ -77,12 +76,12 @@ Blockly.Blocks.Arduino.stepper.stepperDropdownList = function() { ...@@ -77,12 +76,12 @@ Blockly.Blocks.Arduino.stepper.stepperDropdownList = function() {
* @extends {Blockly.FieldDropdown} * @extends {Blockly.FieldDropdown}
* @constructor * @constructor
*/ */
Blockly.Blocks.Arduino.stepper.FieldStepperInstance = function() { Blockly.Blocks.stepper.FieldStepperInstance = function() {
Blockly.Blocks.Arduino.stepper.FieldStepperInstance.superClass_.constructor Blockly.Blocks.stepper.FieldStepperInstance.superClass_.constructor
.call(this, Blockly.Blocks.Arduino.stepper.stepperDropdownList); .call(this, Blockly.Blocks.stepper.stepperDropdownList);
}; };
goog.inherits( goog.inherits(
Blockly.Blocks.Arduino.stepper.FieldStepperInstance, Blockly.FieldDropdown); Blockly.Blocks.stepper.FieldStepperInstance, Blockly.FieldDropdown);
Blockly.Blocks['stepper_config'] = { Blockly.Blocks['stepper_config'] = {
...@@ -93,7 +92,7 @@ Blockly.Blocks['stepper_config'] = { ...@@ -93,7 +92,7 @@ Blockly.Blocks['stepper_config'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/StepperConstructor'); this.setHelpUrl('http://arduino.cc/en/Reference/StepperConstructor');
this.setColour(Blockly.Blocks.Arduino.stepper.HUE); this.setColour(Blockly.Blocks.stepper.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('Setup') .appendField('Setup')
.appendField(new Blockly.FieldTextInput('MyStepper'), 'STEPPER_NAME') .appendField(new Blockly.FieldTextInput('MyStepper'), 'STEPPER_NAME')
...@@ -125,7 +124,7 @@ Blockly.Blocks['stepper_config'] = { ...@@ -125,7 +124,7 @@ Blockly.Blocks['stepper_config'] = {
getStepperSetupInstance: function() { getStepperSetupInstance: function() {
var InstanceName = this.getFieldValue('STEPPER_NAME'); var InstanceName = this.getFieldValue('STEPPER_NAME');
if (!InstanceName) { if (!InstanceName) {
InstanceName = Blockly.Blocks.Arduino.stepper.noName; InstanceName = Blockly.Blocks.stepper.noName;
} }
// Replace all spaces with underscores // Replace all spaces with underscores
return InstanceName.replace(/ /g, '_'); return InstanceName.replace(/ /g, '_');
...@@ -135,9 +134,9 @@ Blockly.Blocks['stepper_config'] = { ...@@ -135,9 +134,9 @@ Blockly.Blocks['stepper_config'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
updateFields: function() { updateFields: function() {
Blockly.Arduino.Boards.refreshBlockFieldDropdown( Blockly.Boards.refreshBlockFieldDropdown(
this, 'STEPPER_PIN1', 'digitalPins'); this, 'STEPPER_PIN1', 'digitalPins');
Blockly.Arduino.Boards.refreshBlockFieldDropdown( Blockly.Boards.refreshBlockFieldDropdown(
this, 'STEPPER_PIN2', 'digitalPins'); this, 'STEPPER_PIN2', 'digitalPins');
} }
}; };
...@@ -149,10 +148,10 @@ Blockly.Blocks['stepper_step'] = { ...@@ -149,10 +148,10 @@ Blockly.Blocks['stepper_step'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/StepperStep'); this.setHelpUrl('http://arduino.cc/en/Reference/StepperStep');
this.setColour(Blockly.Blocks.Arduino.stepper.HUE); this.setColour(Blockly.Blocks.stepper.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('move stepper') .appendField('move stepper')
.appendField(new Blockly.Blocks.Arduino.stepper.FieldStepperInstance(), .appendField(new Blockly.Blocks.stepper.FieldStepperInstance(),
'STEPPER_NAME'); 'STEPPER_NAME');
this.appendValueInput('STEPPER_STEPS') this.appendValueInput('STEPPER_STEPS')
.setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles()); .setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles());
...@@ -170,7 +169,7 @@ Blockly.Blocks['stepper_step'] = { ...@@ -170,7 +169,7 @@ Blockly.Blocks['stepper_step'] = {
{ {
"type": "field_dropdown", "type": "field_dropdown",
"name": "STEPPER_NAME", "name": "STEPPER_NAME",
"options": Blockly.Blocks.Arduino.stepper.stepperDropdownList() "options": Blockly.Blocks.stepper.stepperDropdownList()
}, },
{ {
"type": "input_value", "type": "input_value",
...@@ -181,7 +180,7 @@ Blockly.Blocks['stepper_step'] = { ...@@ -181,7 +180,7 @@ Blockly.Blocks['stepper_step'] = {
"inputsInline": true, "inputsInline": true,
"previousStatement": null, "previousStatement": null,
"nextStatement": null, "nextStatement": null,
"colour": Blockly.Blocks.Arduino.stepper.HUE, "colour": Blockly.Blocks.stepper.HUE,
"tooltip": "Turns the stepper motor a specific number of steps.", "tooltip": "Turns the stepper motor a specific number of steps.",
"helpUrl": "http://arduino.cc/en/Reference/StepperStep" "helpUrl": "http://arduino.cc/en/Reference/StepperStep"
});*/ });*/
...@@ -196,14 +195,13 @@ Blockly.Blocks['stepper_step'] = { ...@@ -196,14 +195,13 @@ Blockly.Blocks['stepper_step'] = {
if (!this.workspace) { return; } // Block has been deleted. if (!this.workspace) { return; } // Block has been deleted.
var currentDropdown = this.getFieldValue('STEPPER_NAME'); var currentDropdown = this.getFieldValue('STEPPER_NAME');
var instances = Blockly.Blocks.Arduino.stepper.stepperDropdownList(); var instances = Blockly.Blocks.stepper.stepperDropdownList();
// Check for configuration block presence // Check for configuration block presence
if (instances[0][0] === Blockly.Blocks.Arduino.stepper.noInstance) { if (instances[0][0] === Blockly.Blocks.stepper.noInstance) {
// Ensure dropdown menu says there is no config block // Ensure dropdown menu says there is no config block
if (currentDropdown !== Blockly.Blocks.Arduino.stepper.noInstance) { if (currentDropdown !== Blockly.Blocks.stepper.noInstance) {
this.setFieldValue( this.setFieldValue(Blockly.Blocks.stepper.noInstance, 'STEPPER_NAME');
Blockly.Blocks.Arduino.stepper.noInstance, 'STEPPER_NAME');
} }
this.setWarningText( this.setWarningText(
'A STEPPER configuration block must be added to use this block!'); 'A STEPPER configuration block must be added to use this block!');
...@@ -212,9 +210,9 @@ Blockly.Blocks['stepper_step'] = { ...@@ -212,9 +210,9 @@ Blockly.Blocks['stepper_step'] = {
var existingConfigSelected = false; var existingConfigSelected = false;
for (var x = 0; x < instances.length; x++) { for (var x = 0; x < instances.length; x++) {
// Check if any of the config blocks does not have a name // Check if any of the config blocks does not have a name
if (instances[x][0] === Blockly.Blocks.Arduino.stepper.noName) { if (instances[x][0] === Blockly.Blocks.stepper.noName) {
// If selected config has no name either, set warning and exit func // If selected config has no name either, set warning and exit func
if (currentDropdown === Blockly.Blocks.Arduino.stepper.noName) { if (currentDropdown === Blockly.Blocks.stepper.noName) {
this.setWarningText('A Name input must be added to the Stepper ' + this.setWarningText('A Name input must be added to the Stepper ' +
'configuration block!'); 'configuration block!');
return; return;
...@@ -229,8 +227,8 @@ Blockly.Blocks['stepper_step'] = { ...@@ -229,8 +227,8 @@ Blockly.Blocks['stepper_step'] = {
// All good, just remove any warnings and exit the function // All good, just remove any warnings and exit the function
this.setWarningText(null); this.setWarningText(null);
} else { } else {
if ((currentDropdown === Blockly.Blocks.Arduino.stepper.noName) || if ((currentDropdown === Blockly.Blocks.stepper.noName) ||
(currentDropdown === Blockly.Blocks.Arduino.stepper.noInstance)) { (currentDropdown === Blockly.Blocks.stepper.noInstance)) {
// Just pick the first config block // Just pick the first config block
this.setFieldValue(instances[0][0], 'STEPPER_NAME'); this.setFieldValue(instances[0][0], 'STEPPER_NAME');
this.setWarningText(null); this.setWarningText(null);
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.time'); goog.provide('Blockly.Blocks.time');
goog.require('Blockly.Arduino'); goog.require('Blockly.Blocks');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.time.HUE = 140; Blockly.Blocks.time.HUE = 140;
Blockly.Blocks['time_delay'] = { Blockly.Blocks['time_delay'] = {
/** /**
...@@ -24,7 +24,7 @@ Blockly.Blocks['time_delay'] = { ...@@ -24,7 +24,7 @@ Blockly.Blocks['time_delay'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/Delay'); this.setHelpUrl('http://arduino.cc/en/Reference/Delay');
this.setColour(Blockly.Blocks.Arduino.time.HUE); this.setColour(Blockly.Blocks.time.HUE);
this.appendValueInput('DELAY_TIME_MILI') this.appendValueInput('DELAY_TIME_MILI')
.setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles()) .setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles())
.appendField('wait'); .appendField('wait');
...@@ -44,7 +44,7 @@ Blockly.Blocks['time_delaymicros'] = { ...@@ -44,7 +44,7 @@ Blockly.Blocks['time_delaymicros'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/DelayMicroseconds'); this.setHelpUrl('http://arduino.cc/en/Reference/DelayMicroseconds');
this.setColour(Blockly.Blocks.Arduino.time.HUE); this.setColour(Blockly.Blocks.time.HUE);
this.appendValueInput('DELAY_TIME_MICRO') this.appendValueInput('DELAY_TIME_MICRO')
.setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles()) .setCheck(Blockly.StaticTyping.BlocklyTypes.NUMBER.compatibles())
.appendField('wait'); .appendField('wait');
...@@ -64,7 +64,7 @@ Blockly.Blocks['time_millis'] = { ...@@ -64,7 +64,7 @@ Blockly.Blocks['time_millis'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/Millis'); this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
this.setColour(Blockly.Blocks.Arduino.time.HUE); this.setColour(Blockly.Blocks.time.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('current elapsed Time (milliseconds)'); .appendField('current elapsed Time (milliseconds)');
this.setOutput(true, Blockly.StaticTyping.BlocklyTypes.NUMBER.basicType); this.setOutput(true, Blockly.StaticTyping.BlocklyTypes.NUMBER.basicType);
...@@ -84,7 +84,7 @@ Blockly.Blocks['time_micros'] = { ...@@ -84,7 +84,7 @@ Blockly.Blocks['time_micros'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/Micros'); this.setHelpUrl('http://arduino.cc/en/Reference/Micros');
this.setColour(Blockly.Blocks.Arduino.time.HUE); this.setColour(Blockly.Blocks.time.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('current elapsed Time (microseconds)'); .appendField('current elapsed Time (microseconds)');
this.setOutput(true, Blockly.StaticTyping.BlocklyTypes.NUMBER.basicType); this.setOutput(true, Blockly.StaticTyping.BlocklyTypes.NUMBER.basicType);
...@@ -107,7 +107,7 @@ Blockly.Blocks['infinite_loop'] = { ...@@ -107,7 +107,7 @@ Blockly.Blocks['infinite_loop'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl(''); this.setHelpUrl('');
this.setColour(Blockly.Blocks.Arduino.time.HUE); this.setColour(Blockly.Blocks.time.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField('wait forever (end program)'); .appendField('wait forever (end program)');
this.setInputsInline(true); this.setInputsInline(true);
......
...@@ -10,14 +10,12 @@ ...@@ -10,14 +10,12 @@
*/ */
'use strict'; 'use strict';
goog.provide('Blockly.Blocks.Arduino.variables'); goog.require('Blockly.Blocks');
goog.require('Blockly.Arduino');
goog.require('Blockly.StaticTyping'); goog.require('Blockly.StaticTyping');
/** Common HSV hue for all blocks in this category. */ /** Common HSV hue for all blocks in this category. */
Blockly.Blocks.Arduino.variables.HUE = 330; Blockly.Blocks.variables.HUE = 330;
Blockly.Blocks['variables_set_type'] = { Blockly.Blocks['variables_set_type'] = {
/** /**
...@@ -26,7 +24,7 @@ Blockly.Blocks['variables_set_type'] = { ...@@ -26,7 +24,7 @@ Blockly.Blocks['variables_set_type'] = {
*/ */
init: function() { init: function() {
this.setHelpUrl('http://arduino.cc/en/Reference/HomePage'); this.setHelpUrl('http://arduino.cc/en/Reference/HomePage');
this.setColour(Blockly.Blocks.Arduino.variables.HUE); this.setColour(Blockly.Blocks.variables.HUE);
this.appendValueInput('VARIABLE_SETTYPE_INPUT'); this.appendValueInput('VARIABLE_SETTYPE_INPUT');
this.appendDummyInput() this.appendDummyInput()
.appendField('as') .appendField('as')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
# #
# This script also generates: # This script also generates:
# blocks_compressed.js: The compressed Blockly language blocks. # blocks_compressed.js: The compressed Blockly language blocks.
# arduino_compressed.js: The compressed Arduino generator.
# javascript_compressed.js: The compressed Javascript generator. # javascript_compressed.js: The compressed Javascript generator.
# python_compressed.js: The compressed Python generator. # python_compressed.js: The compressed Python generator.
# dart_compressed.js: The compressed Dart generator. # dart_compressed.js: The compressed Dart generator.
...@@ -40,7 +41,7 @@ if sys.version_info[0] != 2: ...@@ -40,7 +41,7 @@ if sys.version_info[0] != 2:
raise Exception("Blockly build only compatible with Python 2.x.\n" raise Exception("Blockly build only compatible with Python 2.x.\n"
"You are using: " + sys.version) "You are using: " + sys.version)
import errno, glob, httplib, json, os, re, subprocess, threading, urllib import errno, glob, fnmatch, httplib, json, os, re, subprocess, threading, urllib
def import_path(fullpath): def import_path(fullpath):
...@@ -173,6 +174,7 @@ class Gen_compressed(threading.Thread): ...@@ -173,6 +174,7 @@ class Gen_compressed(threading.Thread):
def run(self): def run(self):
self.gen_core() self.gen_core()
self.gen_blocks() self.gen_blocks()
self.gen_generator("arduino")
self.gen_generator("javascript") self.gen_generator("javascript")
self.gen_generator("python") self.gen_generator("python")
self.gen_generator("php") self.gen_generator("php")
...@@ -202,7 +204,7 @@ class Gen_compressed(threading.Thread): ...@@ -202,7 +204,7 @@ class Gen_compressed(threading.Thread):
params.append(("js_code", "".join(f.readlines()))) params.append(("js_code", "".join(f.readlines())))
f.close() f.close()
self.do_compile(params, target_filename, filenames, "") self.do_compile(params, target_filename, filenames, [])
def gen_blocks(self): def gen_blocks(self):
target_filename = "blocks_compressed.js" target_filename = "blocks_compressed.js"
...@@ -219,14 +221,18 @@ class Gen_compressed(threading.Thread): ...@@ -219,14 +221,18 @@ class Gen_compressed(threading.Thread):
# Read in all the source files. # Read in all the source files.
# Add Blockly.Blocks to be compatible with the compiler. # Add Blockly.Blocks to be compatible with the compiler.
params.append(("js_code", "goog.provide('Blockly.Blocks');")) params.append(("js_code", "goog.provide('Blockly.Blocks');"))
filenames = glob.glob(os.path.join("blocks", "*.js")) params.append(("js_code", "goog.provide('Blockly.StaticTyping');"))
filenames = []
for root, folders, files in os.walk("blocks"):
for filename in fnmatch.filter(files, "*.js"):
filenames.append(os.path.join(root, filename))
for filename in filenames: for filename in filenames:
f = open(filename) f = open(filename)
params.append(("js_code", "".join(f.readlines()))) params.append(("js_code", "".join(f.readlines())))
f.close() f.close()
# Remove Blockly.Blocks to be compatible with Blockly. # Remove Blockly.Blocks to be compatible with Blockly.
remove = "var Blockly={Blocks:{}};" remove = ["var Blockly={Blocks:{}};", "Blockly.StaticTyping={};"]
self.do_compile(params, target_filename, filenames, remove) self.do_compile(params, target_filename, filenames, remove)
def gen_generator(self, language): def gen_generator(self, language):
...@@ -254,7 +260,7 @@ class Gen_compressed(threading.Thread): ...@@ -254,7 +260,7 @@ class Gen_compressed(threading.Thread):
filenames.insert(0, "[goog.provide]") filenames.insert(0, "[goog.provide]")
# Remove Blockly.Generator to be compatible with Blockly. # Remove Blockly.Generator to be compatible with Blockly.
remove = "var Blockly={Generator:{}};" remove = ["var Blockly={Generator:{}};"]
self.do_compile(params, target_filename, filenames, remove) self.do_compile(params, target_filename, filenames, remove)
def do_compile(self, params, target_filename, filenames, remove): def do_compile(self, params, target_filename, filenames, remove):
...@@ -309,7 +315,8 @@ class Gen_compressed(threading.Thread): ...@@ -309,7 +315,8 @@ class Gen_compressed(threading.Thread):
sys.exit(1) sys.exit(1)
code = HEADER + "\n" + json_data["compiledCode"] code = HEADER + "\n" + json_data["compiledCode"]
code = code.replace(remove, "") for code_statement in remove:
code = code.replace(code_statement, "")
# Trim down Google's Apache licences. # Trim down Google's Apache licences.
# The Closure Compiler used to preserve these until August 2015. # The Closure Compiler used to preserve these until August 2015.
......
...@@ -40,6 +40,7 @@ goog.require('Blockly.FieldTextInput'); ...@@ -40,6 +40,7 @@ goog.require('Blockly.FieldTextInput');
goog.require('Blockly.FieldVariable'); goog.require('Blockly.FieldVariable');
goog.require('Blockly.Generator'); goog.require('Blockly.Generator');
goog.require('Blockly.Msg'); goog.require('Blockly.Msg');
goog.require('Blockly.StaticTyping');
goog.require('Blockly.Procedures'); goog.require('Blockly.Procedures');
goog.require('Blockly.Toolbox'); goog.require('Blockly.Toolbox');
goog.require('Blockly.WidgetDiv'); goog.require('Blockly.WidgetDiv');
......
...@@ -14,12 +14,6 @@ goog.require('Blockly.Block'); ...@@ -14,12 +14,6 @@ goog.require('Blockly.Block');
goog.require('Blockly.Workspace'); goog.require('Blockly.Workspace');
/**
* Class for StaticTyping.
* @constructor
*/
Blockly.StaticTyping = function() {};
/** /**
* "Enum-like" object to create blockly variable types. * "Enum-like" object to create blockly variable types.
* The number type is used to set a general number from the number block, the * The number type is used to set a general number from the number block, the
...@@ -354,8 +348,8 @@ Blockly.StaticTyping.manageTypeWarning = function(block, bType, vName, vType) { ...@@ -354,8 +348,8 @@ Blockly.StaticTyping.manageTypeWarning = function(block, bType, vName, vType) {
* Iterates through the list of top level blocks and sets the function arguments * Iterates through the list of top level blocks and sets the function arguments
* types. * types.
* @param {Blockly.Workspace} workspace Blockly Workspace to collect variables. * @param {Blockly.Workspace} workspace Blockly Workspace to collect variables.
* @param {Array<Blockly.StaticTyping.Type>} Associative array with the variable * @param {Array<Blockly.StaticTyping.Type>} varsWithTypes Associative array
* names as the keys and the type as the values. * with the variable names as the keys and the type as the values.
*/ */
Blockly.StaticTyping.setProcedureArgs = function(workspace, varsWithTypes) { Blockly.StaticTyping.setProcedureArgs = function(workspace, varsWithTypes) {
var blocks = workspace.getTopBlocks(); var blocks = workspace.getTopBlocks();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment