Property

NAME_TYPE

static

Constant to separate procedure names from variables and generated functions when running generators.

Deprecated
Use Blockly.PROCEDURE_CATEGORY_NAME

Methods

allProcedures

static

allProcedures(root) returns Array of non-null Array of non-null Array

Find all user-created procedure definitions in a workspace.

Parameter

root

Blockly.Workspace

Root workspace.

Value must not be null.

Returns

non-null Array of non-null Array of non-null Array Pair of arrays, the first contains procedures without return variables, the second with. Each procedure is defined by a three-element list of name, parameter list, and return value boolean.

findLegalName

static

findLegalName(name, block) returns string

Ensure two identically-named procedures don't exist.

Parameter

name

string

Proposed procedure name.

block

Blockly.Block

Block to disambiguate.

Value must not be null.

Returns

string Non-colliding name.

flyoutCategory

static

flyoutCategory(workspace) returns Array of non-null Element

Construct the blocks required by the flyout for the procedure category.

Parameter

workspace

Blockly.Workspace

The workspace containing procedures.

Value must not be null.

Returns

non-null Array of non-null Element Array of XML block elements.

getCallers

static

getCallers(name, workspace) returns Array of non-null Blockly.Block

Find all the callers of a named procedure.

Parameter

name

string

Name of procedure.

workspace

Blockly.Workspace

The workspace to find callers in.

Value must not be null.

Returns

non-null Array of non-null Blockly.Block Array of caller blocks.

getDefinition

static

getDefinition(name, workspace) returns Blockly.Block

Find the definition block for the named procedure.

Parameter

name

string

Name of procedure.

workspace

Blockly.Workspace

The workspace to search.

Value must not be null.

Returns

Blockly.Block The procedure definition block, or null not found.

isNameUsed

static

isNameUsed(name, workspace, opt_exclude) returns boolean

Return if the given name is already a procedure name.

Parameter

name

string

The questionable name.

workspace

Blockly.Workspace

The workspace to scan for collisions.

Value must not be null.

opt_exclude

Optional

Blockly.Block

Optional block to exclude from comparisons (one doesn't want to collide with oneself).

Returns

boolean True if the name is used, otherwise return false.

mutateCallers

static

mutateCallers(defBlock)

When a procedure definition changes its parameters, find and edit all its callers.

Parameter

defBlock

Blockly.Block

Procedure definition block.

Value must not be null.

rename

static

rename(name) returns string

Rename a procedure. Called by the editable field.

Parameter

name

string

The proposed new name.

Returns

string The accepted name.