Skip to main content

blockly > CodeGenerator > scrub_

CodeGenerator.scrub_() method

Common tasks for generating code from blocks. This is called from blockToCode and is called on every block, not just top level blocks. Subclasses may override this, e.g. to generate code for statements following the block, or to handle comments for the specified block and any connected value blocks.

Signature:

scrub_(_block: Block, code: string, _opt_thisOnly?: boolean): string;

Parameters

Parameter

Type

Description

_block

Block

The current block.

code

string

The code created for this block.

_opt_thisOnly

boolean

(Optional) True to generate code for only this statement.

Returns:

string

Code with comments and subsequent blocks added.