Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[truffle] Skeleton of attribute implementation
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/vm/jvm/runtime/org/perl6/nqp/truffle/nodes/sixmodel/NQPAttributeBindNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.perl6.nqp.truffle.nodes.sixmodel; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.NodeInfo; | ||
import org.perl6.nqp.truffle.nodes.NQPNode; | ||
import org.perl6.nqp.truffle.nodes.NQPObjNode; | ||
import org.perl6.nqp.dsl.Deserializer; | ||
|
||
@NodeInfo(shortName = "attribute-bind") | ||
public final class NQPAttributeBindNode extends NQPObjNode { | ||
@Child private NQPNode objNode; | ||
@Child private NQPNode classHandleNode; | ||
private final String name; | ||
@Child private NQPNode valueNode; | ||
|
||
@Deserializer("attribute-bind") | ||
public NQPAttributeBindNode(NQPNode objNode, NQPNode classHandleNode, String name, NQPNode valueNode) { | ||
this.objNode = objNode; | ||
this.classHandleNode = classHandleNode; | ||
this.name= name; | ||
this.valueNode = valueNode; | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
Object obj = objNode.execute(frame); | ||
Object classHandle = classHandleNode.execute(frame); | ||
Object value = valueNode.execute(frame); | ||
System.out.println("attribute-bind: " + name); | ||
//return attribute-bind(obj, classHandleNode, name, value); | ||
return value; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/vm/jvm/runtime/org/perl6/nqp/truffle/nodes/sixmodel/NQPAttributeGetNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.perl6.nqp.truffle.nodes.sixmodel; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.NodeInfo; | ||
import org.perl6.nqp.truffle.nodes.NQPNode; | ||
import org.perl6.nqp.truffle.nodes.NQPObjNode; | ||
import org.perl6.nqp.truffle.runtime.NQPNull; | ||
import org.perl6.nqp.dsl.Deserializer; | ||
|
||
@NodeInfo(shortName = "attribute-get") | ||
public final class NQPAttributeGetNode extends NQPObjNode { | ||
@Child private NQPNode objNode; | ||
@Child private NQPNode classHandleNode; | ||
private final String name; | ||
|
||
@Deserializer("attribute-get") | ||
public NQPAttributeGetNode(NQPNode objNode, NQPNode classHandleNode, String name) { | ||
this.objNode = objNode; | ||
this.classHandleNode = classHandleNode; | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
Object obj = objNode.execute(frame); | ||
Object classHandle = classHandleNode.execute(frame); | ||
|
||
//return attribute-get(objNode.execute(frame), classHandleNode.execute(frame), nameNode.executeStr(frame), dNode.execute(frame)); | ||
System.out.println("attribute-get: " + name); | ||
return NQPNull.SINGLETON; | ||
} | ||
} |