MCPcopy
hub / github.com/RaspberryPiFoundation/blockly / setPreviousStatement

Method setPreviousStatement

packages/blockly/core/block.ts:1251–1277  ·  view source on GitHub ↗

* Set whether this block can chain onto the bottom of another block. * * @param newBoolean True if there can be a previous statement. * @param opt_check Statement type or list of statement types. Null/undefined * if any type could be connected.

(
    newBoolean: boolean,
    opt_check?: string | string[] | null,
  )

Source from the content-addressed store, hash-verified

1249 * if any type could be connected.
1250 */
1251 setPreviousStatement(
1252 newBoolean: boolean,
1253 opt_check?: string | string[] | null,
1254 ) {
1255 if (newBoolean) {
1256 if (opt_check === undefined) {
1257 opt_check = null;
1258 }
1259 if (!this.previousConnection) {
1260 this.previousConnection = this.makeConnection_(
1261 ConnectionType.PREVIOUS_STATEMENT,
1262 );
1263 }
1264 this.previousConnection.setCheck(opt_check);
1265 } else {
1266 if (this.previousConnection) {
1267 if (this.previousConnection.isConnected()) {
1268 throw Error(
1269 'Must disconnect previous statement before removing ' +
1270 'connection.',
1271 );
1272 }
1273 this.previousConnection.dispose();
1274 this.previousConnection = null;
1275 }
1276 }
1277 }
1278
1279 /**
1280 * Set whether another block can chain onto the bottom of this block.

Callers 9

jsonInitMethod · 0.95
lists.tsFile · 0.45
procedures.tsFile · 0.45
block_test.jsFile · 0.45
input_test.jsFile · 0.45
aria_test.jsFile · 0.45
procedures_test.jsFile · 0.45
unittest.jsFile · 0.45
blocks.jsFile · 0.45

Calls 4

makeConnection_Method · 0.95
isConnectedMethod · 0.80
disposeMethod · 0.65
setCheckMethod · 0.45

Tested by

no test coverage detected