Skip to content

Commit 903a97d

Browse files
committed
Replacing RubySourceNode with CoreMethodNode
1 parent 5b21221 commit 903a97d

File tree

2 files changed

+5
-48
lines changed

2 files changed

+5
-48
lines changed

src/main/java/org/truffleruby/core/binding/BindingNodes.java

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.truffleruby.annotations.Primitive;
3030
import org.truffleruby.annotations.Visibility;
3131
import org.truffleruby.builtins.CoreMethodArrayArgumentsNode;
32+
import org.truffleruby.builtins.CoreMethodNode;
3233
import org.truffleruby.builtins.PrimitiveArrayArgumentsNode;
3334
import org.truffleruby.core.array.ArrayHelpers;
3435
import org.truffleruby.core.array.RubyArray;
@@ -282,11 +283,7 @@ public RubyNode cloneUninitialized() {
282283
@NodeChild(value = "bindingNode", type = RubyNode.class)
283284
@NodeChild(value = "nameNode", type = RubyBaseNodeWithExecute.class)
284285
@ImportStatic(BindingNodes.class)
285-
public abstract static class BindingLocalVariableGetNode extends RubySourceNode {
286-
287-
abstract RubyNode getBindingNode();
288-
289-
abstract RubyBaseNodeWithExecute getNameNode();
286+
public abstract static class BindingLocalVariableGetNode extends CoreMethodNode {
290287

291288
@CreateCast("nameNode")
292289
protected RubyBaseNodeWithExecute coerceToString(RubyBaseNodeWithExecute name) {
@@ -298,17 +295,6 @@ protected Object localVariableGet(RubyBinding binding, String name,
298295
@Cached LocalVariableGetNode localVariableGetNode) {
299296
return localVariableGetNode.execute(binding, name);
300297
}
301-
302-
private RubyBaseNodeWithExecute getNameNodeBeforeCasting() {
303-
return ((NameToJavaStringNode) getNameNode()).getValueNode();
304-
}
305-
306-
@Override
307-
public RubyNode cloneUninitialized() {
308-
return BindingNodesFactory.BindingLocalVariableGetNodeFactory.create(
309-
getBindingNode().cloneUninitialized(),
310-
getNameNodeBeforeCasting().cloneUninitialized()).copyFlags(this);
311-
}
312298
}
313299

314300
@GenerateUncached
@@ -345,13 +331,7 @@ protected Object localVariableGetLastLine(RubyBinding binding, String name) {
345331
@NodeChild(value = "bindingNode", type = RubyNode.class)
346332
@NodeChild(value = "nameNode", type = RubyBaseNodeWithExecute.class)
347333
@NodeChild(value = "valueNode", type = RubyNode.class)
348-
public abstract static class BindingLocalVariableSetNode extends RubySourceNode {
349-
350-
abstract RubyNode getBindingNode();
351-
352-
abstract RubyBaseNodeWithExecute getNameNode();
353-
354-
abstract RubyNode getValueNode();
334+
public abstract static class BindingLocalVariableSetNode extends CoreMethodNode {
355335

356336
@CreateCast("nameNode")
357337
protected RubyBaseNodeWithExecute coerceToString(RubyBaseNodeWithExecute name) {
@@ -363,18 +343,6 @@ protected Object localVariableSet(RubyBinding binding, String name, Object value
363343
@Cached LocalVariableSetNode localVariableSetNode) {
364344
return localVariableSetNode.execute(binding, name, value);
365345
}
366-
367-
private RubyBaseNodeWithExecute getNameNodeBeforeCasting() {
368-
return ((NameToJavaStringNode) getNameNode()).getValueNode();
369-
}
370-
371-
@Override
372-
public RubyNode cloneUninitialized() {
373-
return BindingNodesFactory.BindingLocalVariableSetNodeFactory.create(
374-
getBindingNode().cloneUninitialized(),
375-
getNameNodeBeforeCasting().cloneUninitialized(),
376-
getValueNode().cloneUninitialized()).copyFlags(this);
377-
}
378346
}
379347

380348

@@ -394,7 +362,7 @@ public abstract static class LocalVariableSetNode extends RubyBaseNode {
394362
protected Object localVariableSetCached(RubyBinding binding, String name, Object value,
395363
@Cached("name") String cachedName,
396364
@Cached("getFrameDescriptor(binding)") FrameDescriptor cachedFrameDescriptor,
397-
@Cached("findFrameSlotOrNull(name, binding.getFrame())") FindDeclarationVariableNodes.FrameSlotAndDepth cachedFrameSlot,
365+
@Cached("findFrameSlotOrNull(name, binding.getFrame())") FrameSlotAndDepth cachedFrameSlot,
398366
@Cached("createWriteNode(cachedFrameSlot.slot)") WriteFrameSlotNode writeLocalVariableNode) {
399367
final MaterializedFrame frame = RubyArguments
400368
.getDeclarationFrame(binding.getFrame(), cachedFrameSlot.depth);

src/main/java/org/truffleruby/core/string/StringNodes.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
import org.truffleruby.language.RubyBaseNodeWithExecute;
151151
import org.truffleruby.language.RubyGuards;
152152
import org.truffleruby.language.RubyNode;
153-
import org.truffleruby.language.RubySourceNode;
154153
import org.truffleruby.annotations.Visibility;
155154
import org.truffleruby.language.arguments.ReadCallerVariablesNode;
156155
import org.truffleruby.language.control.DeferredRaiseException;
@@ -186,23 +185,13 @@ public abstract class StringNodes {
186185
@GenerateNodeFactory
187186
@CoreMethod(names = { "__allocate__", "__layout_allocate__" }, constructor = true, visibility = Visibility.PRIVATE)
188187
@NodeChild(value = "rubyClassNode", type = RubyNode.class)
189-
public abstract static class StringAllocateNode extends RubySourceNode {
190-
191-
abstract RubyNode getRubyClassNode();
188+
public abstract static class StringAllocateNode extends CoreMethodNode {
192189

193190
@Specialization
194191
protected RubyString allocate(RubyClass rubyClass,
195192
@Cached AllocateNode allocateNode) {
196193
return allocateNode.execute(rubyClass);
197194
}
198-
199-
200-
@Override
201-
public RubyNode cloneUninitialized() {
202-
return StringNodesFactory.StringAllocateNodeFactory.create(getRubyClassNode().cloneUninitialized())
203-
.copyFlags(this);
204-
}
205-
206195
}
207196

208197
@GenerateUncached

0 commit comments

Comments
 (0)