mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Remove duplicated generators.
This commit is contained in:
@@ -245,11 +245,18 @@ Blockly.Dart['text_print'] = function(block) {
|
||||
return 'print(' + argument0 + ');\n';
|
||||
};
|
||||
|
||||
Blockly.Dart['text_prompt'] = function(block) {
|
||||
// Prompt function (internal message).
|
||||
Blockly.Dart['text_prompt_ext'] = function(block) {
|
||||
// Prompt function.
|
||||
Blockly.Dart.definitions_['import_dart_html'] =
|
||||
'import \'dart:html\' as Html;';
|
||||
var msg = Blockly.Dart.quote_(block.getFieldValue('TEXT'));
|
||||
if (block.getField('TEXT')) {
|
||||
// Internal message.
|
||||
var msg = Blockly.Dart.quote_(block.getFieldValue('TEXT'));
|
||||
} else {
|
||||
// External message.
|
||||
var msg = Blockly.Dart.valueToCode(block, 'TEXT',
|
||||
Blockly.Dart.ORDER_NONE) || '\'\'';
|
||||
}
|
||||
var code = 'Html.window.prompt(' + msg + ', \'\')';
|
||||
var toNumber = block.getFieldValue('TYPE') == 'NUMBER';
|
||||
if (toNumber) {
|
||||
@@ -260,18 +267,4 @@ Blockly.Dart['text_prompt'] = function(block) {
|
||||
return [code, Blockly.Dart.ORDER_UNARY_POSTFIX];
|
||||
};
|
||||
|
||||
Blockly.Dart['text_prompt_ext'] = function(block) {
|
||||
// Prompt function (external message).
|
||||
Blockly.Dart.definitions_['import_dart_html'] =
|
||||
'import \'dart:html\' as Html;';
|
||||
var msg = Blockly.Dart.valueToCode(block, 'TEXT',
|
||||
Blockly.Dart.ORDER_NONE) || '\'\'';
|
||||
var code = 'Html.window.prompt(' + msg + ', \'\')';
|
||||
var toNumber = block.getFieldValue('TYPE') == 'NUMBER';
|
||||
if (toNumber) {
|
||||
Blockly.Dart.definitions_['import_dart_math'] =
|
||||
'import \'dart:math\' as Math;';
|
||||
code = 'Math.parseDouble(' + code + ')';
|
||||
}
|
||||
return [code, Blockly.Dart.ORDER_UNARY_POSTFIX];
|
||||
};
|
||||
Blockly.Dart['text_prompt'] = Blockly.Dart['text_prompt_ext'];
|
||||
|
||||
Reference in New Issue
Block a user