Skip to content

Commit 32a51d2

Browse files
author
Killian Perlin
committed
Simplify ListComprehension node
1 parent 78aa850 commit 32a51d2

File tree

1 file changed

+6
-42
lines changed
  • lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/expressions/list_comprehension

1 file changed

+6
-42
lines changed

lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/expressions/list_comprehension/ListComprehension.java

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,13 @@ public final class ListComprehension extends Expr {
3030

3131
// ----- Attributes -----
3232

33-
/** Slots for the list comprehension parameters. */
34-
private final int[] slots;
35-
36-
/** Descriptor of the frame to create. */
37-
private final FrameDescriptor frameDescriptor;
38-
39-
/** Descriptor for the values to close. */
40-
private final ClosureDescriptor closureDescriptor;
41-
4233
// ----- Children -----
4334

4435
/** Generators of the list comprehension. */
4536
@Child
4637
@SuppressWarnings("FieldMayBeFinal")
4738
private ComprehensionAssocList generators;
4839

49-
/** Result expression of the list comprehension. */
50-
@Child
51-
@SuppressWarnings("FieldMayBeFinal")
52-
private Expr expr;
53-
54-
/** Guard expression of the list comprehension. */
55-
@Child
56-
@SuppressWarnings("FieldMayBeFinal")
57-
private Expr guard;
58-
5940
@Child
6041
@SuppressWarnings("FieldMayBeFinal")
6142
private CreateClosureNode createClosureNode;
@@ -84,16 +65,13 @@ public ListComprehension(
8465
final Expr guard
8566
) {
8667
super(location);
87-
this.frameDescriptor = frameDescriptor;
88-
this.closureDescriptor = closureDescriptor;
8968
this.generators = generators;
90-
this.slots = new int[generators.getCompAssocs().length];
91-
for (int i = 0; i < this.slots.length; i++) {
92-
this.slots[i] = generators.getCompAssocs()[i].getSlot();
93-
}
94-
this.expr = expr;
95-
this.guard = guard;
96-
this.rootNode = createRootNode();
69+
this.rootNode = new ListComprehensionRootNode(
70+
LKQLLanguage.getLanguage(this),
71+
frameDescriptor,
72+
guard,
73+
expr
74+
);
9775
this.createClosureNode = new CreateClosureNode(closureDescriptor);
9876
}
9977

@@ -170,20 +148,6 @@ private boolean increaseIndexes(Iterator[] iterators, Object[] valueBuffer) {
170148
return false;
171149
}
172150

173-
/**
174-
* Create a root node for the list comprehension.
175-
*
176-
* @return The root node for the list comprehension execution.
177-
*/
178-
private ListComprehensionRootNode createRootNode() {
179-
return new ListComprehensionRootNode(
180-
LKQLLanguage.getLanguage(this),
181-
this.frameDescriptor,
182-
this.guard,
183-
this.expr
184-
);
185-
}
186-
187151
// ----- Override methods -----
188152

189153
/**

0 commit comments

Comments
 (0)