Skip to content

Commit

Permalink
fix(generators): Improve consistency of migrated language generators (#…
Browse files Browse the repository at this point in the history
…7662)

* docs(generators): @fileoverview -> @file; delete @Suppress

* fix(generators): Fix return type of getAdjusted

  And improve its documentation too.

  Fix the @returns doc for PythonGenerator's getAdjustedInt but
  (for now) don't change the type because it does actually
  return numbers in some circumstances.
  • Loading branch information
cpcallen authored Nov 28, 2023
1 parent ac362fd commit b198e2f
Show file tree
Hide file tree
Showing 33 changed files with 41 additions and 43 deletions.
6 changes: 3 additions & 3 deletions generators/dart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

/**
* @fileoverview Complete helper functions for generating Dart for
* blocks. This is the entrypoint for dart_compressed.js.
* @suppress {extraRequire}
* @file Instantiate a DartGenerator and populate it with the complete
* set of block generator functions for Dart. This is the entrypoint
* for dart_compressed.js.
*/

// Former goog.module ID: Blockly.Dart.all
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/colour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for colour blocks.
* @file Generating Dart for colour blocks.
*/

// Former goog.module ID: Blockly.Dart.colour
Expand Down
4 changes: 2 additions & 2 deletions generators/dart/dart_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ export class DartGenerator extends CodeGenerator {
* @param delta Value to add.
* @param negate Whether to negate the value.
* @param order The highest order acting on this value.
* @returns The adjusted value.
* @returns The adjusted value or code that evaluates to it.
*/
getAdjusted(
block: Block,
atId: string,
delta = 0,
negate = false,
order = Order.NONE,
): string | number {
): string {
if (block.workspace.options.oneBasedIndex) {
delta--;
}
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for list blocks.
* @file Generating Dart for list blocks.
*/

// Former goog.module ID: Blockly.Dart.lists
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for logic blocks.
* @file Generating Dart for logic blocks.
*/

// Former goog.module ID: Blockly.Dart.logic
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for loop blocks.
* @file Generating Dart for loop blocks.
*/

// Former goog.module ID: Blockly.Dart.loops
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for math blocks.
* @file Generating Dart for math blocks.
*/

// Former goog.module ID: Blockly.Dart.math
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for procedure blocks.
* @file Generating Dart for procedure blocks.
*/

// Former goog.module ID: Blockly.Dart.procedures
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for text blocks.
* @file Generating Dart for text blocks.
*/

// Former goog.module ID: Blockly.Dart.texts
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for variable blocks.
* @file Generating Dart for variable blocks.
*/

// Former goog.module ID: Blockly.Dart.variables
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/variables_dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Dart for dynamic variable blocks.
* @file Generating Dart for dynamic variable blocks.
*/

// Former goog.module ID: Blockly.Dart.variablesDynamic
Expand Down
6 changes: 3 additions & 3 deletions generators/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

/**
* @fileoverview Complete helper functions for generating JavaScript for
* blocks. This is the entrypoint for javascript_compressed.js.
* @suppress {extraRequire}
* @file Instantiate a JavascriptGenerator and populate it with the
* complete set of block generator functions for JavaScript. This is
* the entrypoint for javascript_compressed.js.
*/

// Former goog.module ID: Blockly.JavaScript.all
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/colour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for colour blocks.
* @file Generating JavaScript for colour blocks.
*/

// Former goog.module ID: Blockly.JavaScript.colour
Expand Down
4 changes: 2 additions & 2 deletions generators/javascript/javascript_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ export class JavascriptGenerator extends CodeGenerator {
* @param delta Value to add.
* @param negate Whether to negate the value.
* @param order The highest order acting on this value.
* @returns The adjusted value.
* @returns The adjusted value or code that evaluates to it.
*/
getAdjusted(
block: Block,
atId: string,
delta = 0,
negate = false,
order = Order.NONE,
): string | number {
): string {
if (block.workspace.options.oneBasedIndex) {
delta--;
}
Expand Down
3 changes: 1 addition & 2 deletions generators/javascript/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for list blocks.
* @suppress {missingRequire}
* @file Generating JavaScript for list blocks.
*/

// Former goog.module ID: Blockly.JavaScript.lists
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for logic blocks.
* @file Generating JavaScript for logic blocks.
*/

// Former goog.module ID: Blockly.JavaScript.logic
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for loop blocks.
* @file Generating JavaScript for loop blocks.
*/

// Former goog.module ID: Blockly.JavaScript.loops
Expand Down
3 changes: 1 addition & 2 deletions generators/javascript/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for math blocks.
* @suppress {missingRequire}
* @file Generating JavaScript for math blocks.
*/

// Former goog.module ID: Blockly.JavaScript.math
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for procedure blocks.
* @file Generating JavaScript for procedure blocks.
*/

// Former goog.module ID: Blockly.JavaScript.procedures
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for text blocks.
* @file Generating JavaScript for text blocks.
*/

// Former goog.module ID: Blockly.JavaScript.texts
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for variable blocks.
* @file Generating JavaScript for variable blocks.
*/

// Former goog.module ID: Blockly.JavaScript.variables
Expand Down
2 changes: 1 addition & 1 deletion generators/javascript/variables_dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating JavaScript for dynamic variable blocks.
* @file Generating JavaScript for dynamic variable blocks.
*/

// Former goog.module ID: Blockly.JavaScript.variablesDynamic
Expand Down
6 changes: 3 additions & 3 deletions generators/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

/**
* @fileoverview Complete helper functions for generating Python for
* blocks. This is the entrypoint for python_compressed.js.
* @suppress {extraRequire}
* @file Instantiate a PythonGenerator and populate it with the
* complete set of block generator functions for Python. This is the
* entrypoint for python_compressed.js.
*/

// Former goog.module ID: Blockly.Python.all
Expand Down
2 changes: 1 addition & 1 deletion generators/python/colour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for colour blocks.
* @file Generating Python for colour blocks.
*/

// Former goog.module ID: Blockly.Python.colour
Expand Down
2 changes: 1 addition & 1 deletion generators/python/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for list blocks.
* @file Generating Python for list blocks.
*/

// Former goog.module ID: Blockly.Python.lists
Expand Down
2 changes: 1 addition & 1 deletion generators/python/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for logic blocks.
* @file Generating Python for logic blocks.
*/

// Former goog.module ID: Blockly.Python.logic
Expand Down
2 changes: 1 addition & 1 deletion generators/python/loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for loop blocks.
* @file Generating Python for loop blocks.
*/

// Former goog.module ID: Blockly.Python.loops
Expand Down
2 changes: 1 addition & 1 deletion generators/python/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for math blocks.
* @file Generating Python for math blocks.
*/

// Former goog.module ID: Blockly.Python.math
Expand Down
2 changes: 1 addition & 1 deletion generators/python/procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for procedure blocks.
* @file Generating Python for procedure blocks.
*/

// Former goog.module ID: Blockly.Python.procedures
Expand Down
2 changes: 1 addition & 1 deletion generators/python/python_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class PythonGenerator extends CodeGenerator {
* @param atId The ID of the input block to get (and adjust) the value of.
* @param delta Value to add.
* @param negate Whether to negate the value.
* @returns The adjusted value.
* @returns The adjusted value or code that evaluates to it.
*/
getAdjustedInt(
block: Block,
Expand Down
2 changes: 1 addition & 1 deletion generators/python/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for text blocks.
* @file Generating Python for text blocks.
*/

// Former goog.module ID: Blockly.Python.texts
Expand Down
2 changes: 1 addition & 1 deletion generators/python/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for variable blocks.
* @file Generating Python for variable blocks.
*/

// Former goog.module ID: Blockly.Python.variables
Expand Down
2 changes: 1 addition & 1 deletion generators/python/variables_dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/**
* @fileoverview Generating Python for dynamic variable blocks.
* @file Generating Python for dynamic variable blocks.
*/

// Former goog.module ID: Blockly.Python.variablesDynamic
Expand Down

0 comments on commit b198e2f

Please sign in to comment.