mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
feat: make ordered argument optional for workspace functions (#7424)
This commit is contained in:
@@ -206,7 +206,7 @@ export class Workspace implements IASTNodeLocation {
|
||||
* @param ordered Sort the list if true.
|
||||
* @returns The top-level block objects.
|
||||
*/
|
||||
getTopBlocks(ordered: boolean): Block[] {
|
||||
getTopBlocks(ordered = false): Block[] {
|
||||
// Copy the topBlocks list.
|
||||
const blocks = new Array<Block>().concat(this.topBlocks);
|
||||
if (ordered && blocks.length > 1) {
|
||||
@@ -247,7 +247,7 @@ export class Workspace implements IASTNodeLocation {
|
||||
* @param ordered Sort the list if true.
|
||||
* @returns The blocks of the given type.
|
||||
*/
|
||||
getBlocksByType(type: string, ordered: boolean): Block[] {
|
||||
getBlocksByType(type: string, ordered = false): Block[] {
|
||||
if (!this.typedBlocksDB.has(type)) {
|
||||
return [];
|
||||
}
|
||||
@@ -307,7 +307,7 @@ export class Workspace implements IASTNodeLocation {
|
||||
* @returns The top-level comment objects.
|
||||
* @internal
|
||||
*/
|
||||
getTopComments(ordered: boolean): WorkspaceComment[] {
|
||||
getTopComments(ordered = false): WorkspaceComment[] {
|
||||
// Copy the topComments list.
|
||||
const comments = new Array<WorkspaceComment>().concat(this.topComments);
|
||||
if (ordered && comments.length > 1) {
|
||||
@@ -323,7 +323,7 @@ export class Workspace implements IASTNodeLocation {
|
||||
* @param ordered Sort the list if true.
|
||||
* @returns Array of blocks.
|
||||
*/
|
||||
getAllBlocks(ordered: boolean): Block[] {
|
||||
getAllBlocks(ordered = false): Block[] {
|
||||
let blocks: Block[];
|
||||
if (ordered) {
|
||||
// Slow, but ordered.
|
||||
|
||||
Reference in New Issue
Block a user