Fix block width when communicating with references [#21]
This commit is contained in:
parent
c60f2fa0f9
commit
82a2c1a219
|
@ -2713,10 +2713,12 @@ define('sequence/Generator',['core/ArrayUtilities'], (array) => {
|
|||
|
||||
let colAgents = agents.map(this.convertAgent);
|
||||
this.validateAgents(colAgents, {allowGrouped: true});
|
||||
colAgents = this.expandGroupedAgentConnection(colAgents);
|
||||
|
||||
const allAgents = array.flatMap(colAgents, this.expandGroupedAgent);
|
||||
this.defineAgents(allAgents);
|
||||
|
||||
colAgents = this.expandGroupedAgentConnection(colAgents);
|
||||
const agentNames = colAgents.map(Agent.getName);
|
||||
this.defineAgents(colAgents);
|
||||
|
||||
const implicitBegin = (agents
|
||||
.filter(Agent.hasFlag('begin', false))
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -689,10 +689,12 @@ define(['core/ArrayUtilities'], (array) => {
|
|||
|
||||
let colAgents = agents.map(this.convertAgent);
|
||||
this.validateAgents(colAgents, {allowGrouped: true});
|
||||
colAgents = this.expandGroupedAgentConnection(colAgents);
|
||||
|
||||
const allAgents = array.flatMap(colAgents, this.expandGroupedAgent);
|
||||
this.defineAgents(allAgents);
|
||||
|
||||
colAgents = this.expandGroupedAgentConnection(colAgents);
|
||||
const agentNames = colAgents.map(Agent.getName);
|
||||
this.defineAgents(colAgents);
|
||||
|
||||
const implicitBegin = (agents
|
||||
.filter(Agent.hasFlag('begin', false))
|
||||
|
|
|
@ -1271,6 +1271,52 @@ defineDescribe('Sequence Generator', ['./Generator'], (Generator) => {
|
|||
]})).toThrow(new Error('Agent B is hidden behind group at line 1'));
|
||||
});
|
||||
|
||||
it('encompasses entire reference boxes in block statements', () => {
|
||||
const sequenceR = generator.generate({stages: [
|
||||
PARSED.beginAgents(['A', 'B', 'C', 'D']),
|
||||
PARSED.groupBegin('BC', ['B', 'C'], {label: 'Foo'}),
|
||||
PARSED.blockBegin('if', 'abc'),
|
||||
PARSED.connect(['BC', 'D']),
|
||||
PARSED.blockEnd(),
|
||||
PARSED.endAgents(['BC']),
|
||||
]});
|
||||
|
||||
expect(sequenceR.agents).toEqual([
|
||||
{name: '[', anchorRight: true},
|
||||
{name: 'A', anchorRight: false},
|
||||
{name: '__BLOCK1[', anchorRight: true},
|
||||
{name: '__BLOCK0[', anchorRight: true},
|
||||
{name: 'B', anchorRight: false},
|
||||
{name: 'C', anchorRight: false},
|
||||
{name: '__BLOCK0]', anchorRight: false},
|
||||
{name: 'D', anchorRight: false},
|
||||
{name: '__BLOCK1]', anchorRight: false},
|
||||
{name: ']', anchorRight: false},
|
||||
]);
|
||||
|
||||
const sequenceL = generator.generate({stages: [
|
||||
PARSED.beginAgents(['A', 'B', 'C', 'D']),
|
||||
PARSED.groupBegin('BC', ['B', 'C'], {label: 'Foo'}),
|
||||
PARSED.blockBegin('if', 'abc'),
|
||||
PARSED.connect(['BC', 'A']),
|
||||
PARSED.blockEnd(),
|
||||
PARSED.endAgents(['BC']),
|
||||
]});
|
||||
|
||||
expect(sequenceL.agents).toEqual([
|
||||
{name: '[', anchorRight: true},
|
||||
{name: '__BLOCK1[', anchorRight: true},
|
||||
{name: 'A', anchorRight: false},
|
||||
{name: '__BLOCK0[', anchorRight: true},
|
||||
{name: 'B', anchorRight: false},
|
||||
{name: 'C', anchorRight: false},
|
||||
{name: '__BLOCK0]', anchorRight: false},
|
||||
{name: '__BLOCK1]', anchorRight: false},
|
||||
{name: 'D', anchorRight: false},
|
||||
{name: ']', anchorRight: false},
|
||||
]);
|
||||
});
|
||||
|
||||
it('rejects unterminated blocks', () => {
|
||||
expect(() => generator.generate({stages: [
|
||||
PARSED.blockBegin('if', 'abc'),
|
||||
|
|
Loading…
Reference in New Issue