File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 50
50
import com .oracle .truffle .api .nodes .NodeCost ;
51
51
import com .oracle .truffle .api .nodes .UnexpectedResultException ;
52
52
53
+ /**
54
+ * Base class for all expressions. Expressions always return a value.
55
+ */
53
56
@ GenerateWrapper
54
57
public abstract class ExpressionNode extends PNode {
55
58
@@ -119,6 +122,10 @@ public NodeCost getCost() {
119
122
}
120
123
}
121
124
125
+ /**
126
+ * If expressions appear in a block of statements, they are wrapped in a
127
+ * {@link StatementNode} that simply drops the result.
128
+ */
122
129
public final StatementNode asStatement () {
123
130
return new ExpressionStatementNode (this );
124
131
}
@@ -145,6 +152,11 @@ public boolean hasSideEffectAsAnExpression() {
145
152
}
146
153
}
147
154
155
+ /**
156
+ * Some expressions can have hidden side-effects such as writing to a
157
+ * temporary variable. These can be wrapped together with their side
158
+ * effecting {@link StatementNode}.
159
+ */
148
160
public final ExpressionNode withSideEffect (StatementNode sideEffect ) {
149
161
return new ExpressionWithSideEffects (this , sideEffect );
150
162
}
Original file line number Diff line number Diff line change 34
34
import com .oracle .truffle .api .instrumentation .Tag ;
35
35
36
36
/**
37
- * Base class for most statements, except for FrameSlotNodes.
38
- *
37
+ * Base class for all statements. Statements never return a value.
39
38
*/
40
39
@ GenerateWrapper
41
40
public abstract class StatementNode extends PNode {
You can’t perform that action at this time.
0 commit comments