Fix order errors in text generators (#4329)

* Fix dart text generator logic

* Fix Javascript text generator logic.

* Fix Lua text generator logic

* Fix php text generator logic

* Fix python text generator logic

* Fix error in substring logic

* Fix unit test block generators

* Update from ORDER_COMMA to ORDER_NONE

* Update golden files
This commit is contained in:
Monica Kozbial
2020-09-30 14:08:45 -07:00
committed by GitHub
parent 64fe425944
commit 81d355f5fa
17 changed files with 139 additions and 118 deletions

View File

@@ -50,7 +50,7 @@ Blockly.Dart.addReservedWords(
/**
* Order of operation ENUMs.
* https://www.dartlang.org/docs/dart-up-and-running/ch02.html#operator_table
* https://dart.dev/guides/language/language-tour#operators
*/
Blockly.Dart.ORDER_ATOMIC = 0; // 0 "" ...
Blockly.Dart.ORDER_UNARY_POSTFIX = 1; // expr++ expr-- () [] . ?.
@@ -158,7 +158,7 @@ Blockly.Dart.scrubNakedValue = function(line) {
* Encode a string as a properly escaped Dart string, complete with quotes.
* @param {string} string Text to encode.
* @return {string} Dart string.
* @private
* @protected
*/
Blockly.Dart.quote_ = function(string) {
// Can't use goog.string.quote since $ must also be escaped.
@@ -174,7 +174,7 @@ Blockly.Dart.quote_ = function(string) {
* quotes.
* @param {string} string Text to encode.
* @return {string} Dart string.
* @private
* @protected
*/
Blockly.Dart.multiline_quote_ = function (string) {
var lines = string.split(/\n/g).map(Blockly.Dart.quote_);
@@ -183,7 +183,6 @@ Blockly.Dart.multiline_quote_ = function (string) {
return lines.join(' + \'\\n\' + \n');
};
/**
* Common tasks for generating Dart from blocks.
* Handles comments for the specified block and any connected value blocks.
@@ -192,7 +191,7 @@ Blockly.Dart.multiline_quote_ = function (string) {
* @param {string} code The Dart code created for this block.
* @param {boolean=} opt_thisOnly True to generate code for only this statement.
* @return {string} Dart code with comments and subsequent blocks added.
* @private
* @protected
*/
Blockly.Dart.scrub_ = function(block, code, opt_thisOnly) {
var commentCode = '';