Skip to content

Commit 1c84913

Browse files
author
Killian Perlin
committed
Fixed property access on dynamic nodes
1 parent 9b8eace commit 1c84913

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/expressions/dot/DotAccess.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
package com.adacore.lkql_jit.nodes.expressions.dot;
77

88
import com.adacore.langkit_support.LangkitSupport;
9+
import com.adacore.lkql_jit.LKQLTypeSystemGen;
910
import com.adacore.lkql_jit.exception.LKQLRuntimeException;
1011
import com.adacore.lkql_jit.nodes.Identifier;
11-
import com.adacore.lkql_jit.runtime.values.LKQLNamespace;
12-
import com.adacore.lkql_jit.runtime.values.LKQLNull;
13-
import com.adacore.lkql_jit.runtime.values.LKQLObject;
14-
import com.adacore.lkql_jit.runtime.values.LKQLProperty;
12+
import com.adacore.lkql_jit.runtime.values.*;
1513
import com.adacore.lkql_jit.utils.Constants;
1614
import com.adacore.lkql_jit.utils.LKQLTypesHelper;
1715
import com.oracle.truffle.api.dsl.Cached;
@@ -130,6 +128,18 @@ protected Object onNodeUncached(LangkitSupport.NodeInterface receiver) {
130128
return this.onNodeCached(receiver, property, property.isField());
131129
}
132130

131+
@Specialization
132+
protected Object onDynamicAdaNode(final DynamicAdaNode receiver) {
133+
var res = receiver.getField(this.member.getName());
134+
if (res == null && receiver instanceof AdaNodeProxy proxy) {
135+
res = this.onNodeUncached(proxy.base);
136+
if (LKQLTypeSystemGen.isNodeInterface(res)) {
137+
return AdaNodeProxy.convertAST(LKQLTypeSystemGen.asNodeInterface(res));
138+
}
139+
}
140+
return res;
141+
}
142+
133143
/** Fallback when the receiver is none of the case identified by the specializations. */
134144
@Fallback
135145
protected Object onOthers(Object receiver) {

lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/patterns/node_patterns/NodePatternProperty.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.adacore.lkql_jit.exception.LKQLRuntimeException;
1010
import com.adacore.lkql_jit.nodes.expressions.Expr;
1111
import com.adacore.lkql_jit.nodes.patterns.BasePattern;
12+
import com.adacore.lkql_jit.runtime.values.AdaNodeProxy;
1213
import com.adacore.lkql_jit.runtime.values.LKQLProperty;
1314
import com.adacore.lkql_jit.utils.Constants;
1415
import com.adacore.lkql_jit.utils.functions.ReflectionUtils;
@@ -125,6 +126,11 @@ protected boolean propertyUncached(VirtualFrame frame, LangkitSupport.NodeInterf
125126
return this.propertyCached(frame, node, property);
126127
}
127128

129+
@Specialization
130+
protected boolean propertyAdaNodeProxy(VirtualFrame frame, AdaNodeProxy node) {
131+
return this.propertyUncached(frame, node.base);
132+
}
133+
128134
// ----- Override methods -----
129135

130136
/**

0 commit comments

Comments
 (0)