-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add property write expressions to the EasyScript grammar.
- Loading branch information
Showing
5 changed files
with
37 additions
and
3 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
3 changes: 1 addition & 2 deletions
3
...-13/src/main/java/com/endoflineblog/truffle/part_13/nodes/exprs/objects/ThisExprNode.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
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
24 changes: 24 additions & 0 deletions
24
.../java/com/endoflineblog/truffle/part_13/nodes/exprs/properties/PropertyWriteExprNode.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,24 @@ | ||
package com.endoflineblog.truffle.part_13.nodes.exprs.properties; | ||
|
||
import com.endoflineblog.truffle.part_13.exceptions.EasyScriptException; | ||
import com.endoflineblog.truffle.part_13.nodes.exprs.EasyScriptExprNode; | ||
import com.oracle.truffle.api.dsl.Cached; | ||
import com.oracle.truffle.api.dsl.NodeChild; | ||
import com.oracle.truffle.api.dsl.NodeField; | ||
import com.oracle.truffle.api.dsl.Specialization; | ||
|
||
/** | ||
* The Node for reading properties of objects. | ||
* Used in code like {@code t.myProp = 3}. | ||
*/ | ||
@NodeChild("targetExpr") | ||
@NodeField(name = "propertyName", type = String.class) | ||
@NodeChild("rvalueExpr") | ||
public abstract class PropertyWriteExprNode extends EasyScriptExprNode { | ||
protected abstract String getPropertyName(); | ||
|
||
@Specialization | ||
protected Object writeProperty(Object target, Object rvalue) { | ||
throw new EasyScriptException("PropertyWriteExprNode.writeProperty() not implemented yet"); | ||
} | ||
} |
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