Skip to content

Commit b40232a

Browse files
committed
Change linked list to jut a counter, since we don't use the beginItem for anything other than that
1 parent c5b841b commit b40232a

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

ts/input/tex/newcommand/NewcommandMethods.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ const NewcommandMethods: { [key: string]: ParseMethod } = {
259259
delete parser.stack.env['closing'];
260260
const beginN = parser.stack.global['beginEnv'] as number;
261261
if (beginN) {
262-
const beginItem = parser.stack.Top(parser.stack.height - beginN);
263-
const prevBegin = beginItem.getProperty('prev-begin') as number;
264-
parser.stack.global['beginEnv'] = prevBegin || 0;
262+
(parser.stack.global['beginEnv'] as number)--;
265263
if (edef) {
266264
// Parse the commands in the end environment definition.
267265
let rest = parser.string.slice(parser.i);
@@ -297,12 +295,10 @@ const NewcommandMethods: { [key: string]: ParseMethod } = {
297295
parser.string.slice(parser.i)
298296
);
299297
parser.i = 0;
300-
const item = parser.itemFactory
298+
parser.stack.global['beginEnv'] = (parser.stack.global['beginEnv'] as number || 0) + 1;
299+
return parser.itemFactory
301300
.create('beginEnv')
302-
.setProperty('name', name)
303-
.setProperty('prev-begin', parser.stack.global['beginEnv']);
304-
parser.stack.global['beginEnv'] = parser.stack.height;
305-
return item;
301+
.setProperty('name', name);
306302
},
307303

308304
Macro: BaseMethods.Macro,

0 commit comments

Comments
 (0)