2016-04-26 16:50:49 -04:00
|
|
|
/**
|
|
|
|
* A thread is a running stack context and all the metadata needed.
|
|
|
|
* @param {?string} firstBlock First block to execute in the thread.
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function Thread (firstBlock) {
|
2016-04-26 15:00:45 -04:00
|
|
|
/**
|
|
|
|
* Next block that the thread will execute.
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2016-04-26 16:50:49 -04:00
|
|
|
this.nextBlock = firstBlock;
|
2016-04-26 15:00:45 -04:00
|
|
|
/**
|
|
|
|
* Stack for the thread. When the sequencer enters a control structure,
|
|
|
|
* the block is pushed onto the stack so we know where to exit.
|
|
|
|
* @type {Array.<string>}
|
|
|
|
*/
|
|
|
|
this.stack = [];
|
2016-04-18 17:20:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Thread;
|