Skip to content
Snippets Groups Projects
Commit 9e32662d authored by Sebastian Biewer's avatar Sebastian Biewer
Browse files

added for loop subnodes in correct order

parent 2c3d5abb
No related branches found
No related tags found
1 merge request!2Switch pseuco-lang to typescript
......@@ -9,14 +9,16 @@ export class ForStatement extends Node {
readonly loopUpdates: StatementExpression[];
constructor(line: number, column: number, loopBody: StatementWrapper, loopInit: ForInit | null, predicate: Expression | null, ...loopUpdates: StatementExpression[]) {
const children: [Node] = [loopBody];
var children: Array<Node> = new Array<Node>();
if (loopInit != null) {
children.push(loopInit);
}
if (predicate != null) {
children.push(predicate);
}
super(line, column, ...(children.concat(loopUpdates)));
children = children.concat(loopUpdates);
children.push(loopBody);
super(line, column, ...children);
this.loopBody = loopBody;
this.loopInit = loopInit;
this.predicate = predicate;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment