Skip to content

Commit 8103662

Browse files
committed
Remove the object concatenation support
1 parent aad9567 commit 8103662

File tree

14 files changed

+34
-107
lines changed

14 files changed

+34
-107
lines changed

lkql_checker/doc/gnatcheck_rm/using_gnatcheck.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,8 @@ the following configuration will raise an error:
592592

593593
You cannot provide more than **one** LKQL rule file when running GNATcheck. In
594594
order to compose a rule file with another you have to use the
595-
:ref:`LKQL importation mechanism<module_importation>` and concatenate rule
596-
objects. Here is an example of LKQL rule file composition:
595+
:ref:`LKQL importation mechanism<module_importation>` and combine rule objects.
596+
Here is an example of LKQL rule file composition:
597597

598598
.. code-block:: lkql
599599
@@ -609,9 +609,9 @@ objects. Here is an example of LKQL rule file composition:
609609
610610
import common_rules
611611
612-
val rules = common_rules.rules & @{
613-
Redundant_Null_Statements
614-
}
612+
val rules = common_rules.rules.combine(
613+
@{ Redundant_Null_Statements }
614+
)
615615
616616
Then you can run GNATcheck with the ``specific_rules.lkql`` file as coding
617617
standard to perform rules defined in ``common_rules.lkql`` combined to the ones
@@ -641,9 +641,12 @@ invalid:
641641
642642
import common_rules
643643
644-
val rules = common_rules.rules & @{
645-
Forbidden_Attributes: {Forbidden: ["Last"], instance_name: "Forbid_Attr"}
646-
}
644+
val rules = common_rules.rules.combine(@{
645+
Forbidden_Attributes: {
646+
Forbidden: ["Last"],
647+
instance_name: "Forbid_Attr"
648+
}
649+
})
647650
# error: This rule configuration defines two instances with the same name: "Forbid_Attr"
648651
649652

lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/utils/ConcatenationNode.java

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@
77

88
import com.adacore.lkql_jit.exception.LKQLRuntimeException;
99
import com.adacore.lkql_jit.nodes.LKQLNode;
10-
import com.adacore.lkql_jit.runtime.values.LKQLObject;
1110
import com.adacore.lkql_jit.runtime.values.lists.LKQLList;
12-
import com.adacore.lkql_jit.utils.Constants;
1311
import com.adacore.lkql_jit.utils.LKQLTypesHelper;
1412
import com.adacore.lkql_jit.utils.functions.StringUtils;
15-
import com.oracle.truffle.api.dsl.Cached;
1613
import com.oracle.truffle.api.dsl.Fallback;
1714
import com.oracle.truffle.api.dsl.Specialization;
18-
import com.oracle.truffle.api.library.CachedLibrary;
1915
import com.oracle.truffle.api.nodes.Node;
20-
import com.oracle.truffle.api.object.DynamicObjectLibrary;
2116

2217
public abstract class ConcatenationNode extends Node {
2318

@@ -43,48 +38,6 @@ protected LKQLList doLists(LKQLList left, LKQLList right, LKQLNode caller) {
4338
return new LKQLList(resContent);
4439
}
4540

46-
@Specialization(limit = Constants.SPECIALIZED_LIB_LIMIT)
47-
protected LKQLObject doObjects(
48-
LKQLObject left,
49-
LKQLObject right,
50-
LKQLNode caller,
51-
@CachedLibrary("left") DynamicObjectLibrary leftLib,
52-
@CachedLibrary("right") DynamicObjectLibrary rightLib,
53-
@CachedLibrary(limit = Constants.DISPATCHED_LIB_LIMIT) DynamicObjectLibrary resLib,
54-
@Cached ConcatenationNode innerConcat
55-
) {
56-
// Create the result object
57-
LKQLObject res = new LKQLObject(LKQLObject.emptyShape());
58-
59-
// Insert all keys of the left object in the result, resolving conflicts by merging
60-
// values.
61-
for (var key : leftLib.getKeyArray(left)) {
62-
if (!rightLib.containsKey(right, key)) {
63-
resLib.put(res, key, leftLib.getOrDefault(left, key, null));
64-
} else {
65-
resLib.put(
66-
res,
67-
key,
68-
innerConcat.execute(
69-
leftLib.getOrDefault(left, key, null),
70-
rightLib.getOrDefault(right, key, null),
71-
caller
72-
)
73-
);
74-
}
75-
}
76-
77-
// Insert keys from the right object that aren't in the resulting object
78-
for (var key : rightLib.getKeyArray(right)) {
79-
if (!resLib.containsKey(res, key)) {
80-
resLib.put(res, key, rightLib.getOrDefault(right, key, null));
81-
}
82-
}
83-
84-
// Return the resulting object
85-
return res;
86-
}
87-
8841
@Fallback
8942
protected void nonConcatenable(Object left, Object right, LKQLNode caller) {
9043
throw LKQLRuntimeException.unsupportedOperation(
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import null_stmt
22

3-
val rules = null_stmt.rules & @{
4-
Goto_Statements
5-
}
3+
val rules = null_stmt.rules.combine(
4+
@{ Goto_Statements }
5+
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import part_one
22

3-
val rules = part_one.rules & @{
4-
Goto_Statements
5-
}
3+
val rules = part_one.rules.combine(
4+
@{ Goto_Statements }
5+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import null_stmt
22

3-
val rules = null_stmt.rules @{}
3+
val rules = null_stmt.rules.combine(@{})
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
val rules = @{
2+
Redundant_Null_Statements
3+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import part_two
22

3-
val rules = part_two.rules & @{
4-
Redundant_Null_Statements
5-
}
3+
val rules = part_two.rules.combine(
4+
@{ Redundant_Null_Statements }
5+
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import part_one
22

3-
val rules = part_one.rules & @{
4-
Blocks
5-
}
3+
val rules = part_one.rules.combine(
4+
@{ Blocks }
5+
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import uncond_goto_stmt
22

3-
val rules = uncond_goto_stmt.rules & @{
4-
Goto_Statements
5-
}
3+
val rules = uncond_goto_stmt.rules.combine(
4+
@{ Goto_Statements }
5+
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import null_stmt
22

3-
val rules = null_stmt.rules & @{
4-
Goto_Statements
5-
}
3+
val rules = null_stmt.rules.combine(
4+
@{ Goto_Statements }
5+
)

0 commit comments

Comments
 (0)