File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/expression Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 47
47
import com .oracle .truffle .api .instrumentation .GenerateWrapper ;
48
48
import com .oracle .truffle .api .instrumentation .ProbeNode ;
49
49
import com .oracle .truffle .api .instrumentation .StandardTags .ExpressionTag ;
50
+ import com .oracle .truffle .api .instrumentation .StandardTags .StatementTag ;
50
51
import com .oracle .truffle .api .instrumentation .Tag ;
51
52
import com .oracle .truffle .api .nodes .ExplodeLoop ;
53
+ import com .oracle .truffle .api .nodes .Node ;
52
54
import com .oracle .truffle .api .nodes .NodeCost ;
53
55
import com .oracle .truffle .api .nodes .UnexpectedResultException ;
54
56
@@ -102,7 +104,16 @@ public WrapperNode createWrapper(ProbeNode probe) {
102
104
103
105
@ Override
104
106
public boolean hasTag (Class <? extends Tag > tag ) {
105
- return tag == ExpressionTag .class || super .hasTag (tag );
107
+ return tag == ExpressionTag .class || (tag == StatementTag .class && isStatement ()) || super .hasTag (tag );
108
+ }
109
+
110
+ private boolean isStatement () {
111
+ Node parent = getParent ();
112
+ if (parent instanceof WrapperNode ) {
113
+ parent = parent .getParent ();
114
+ }
115
+ // expressions with these parents are considered to be statements
116
+ return parent instanceof ExpressionWithSideEffect || parent instanceof ExpressionWithSideEffects ;
106
117
}
107
118
108
119
public static final class ExpressionStatementNode extends StatementNode {
You can’t perform that action at this time.
0 commit comments