diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java @ 18990:d1c1cd2530d7

Truffle/Instrumentation: clean up and repair some old unit tests
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 27 Jan 2015 20:28:43 -0800
parents e3c95cbbb50c
children 6f1afa58a9b8
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java	Tue Jan 27 20:28:19 2015 -0800
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStandardASTProber.java	Tue Jan 27 20:28:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,31 +44,35 @@
      */
     public boolean visit(Node node) {
 
-        if (node instanceof SLStatementNode) {
+        if (node.isInstrumentable()) {
+
+            if (node instanceof SLStatementNode) {
 
-            // We have to distinguish between SLExpressionNode and SLStatementNode since some of the
-            // generated factories have methods that require SLExpressionNodes as parameters. Since
-            // SLExpressionNodes are a subclass of SLStatementNode, we check if something is an
-            // SLExpressionNode first.
-            if (node instanceof SLExpressionNode && node.getParent() != null) {
-                SLExpressionNode expressionNode = (SLExpressionNode) node;
-                if (expressionNode.getSourceSection() != null) {
-                    Probe probe = expressionNode.probe();
+                // Distinguish between SLExpressionNode and SLStatementNode since some of the
+                // generated factory methods that require SLExpressionNodes as parameters.
+                // Since
+                // SLExpressionNodes are a subclass of SLStatementNode, check if something is an
+                // SLExpressionNode first.
+                if (node instanceof SLExpressionNode && node.getParent() != null) {
+                    SLExpressionNode expressionNode = (SLExpressionNode) node;
+                    if (expressionNode.getSourceSection() != null) {
+                        Probe probe = expressionNode.probe();
 
-                    if (node instanceof SLWriteLocalVariableNode) {
+                        if (node instanceof SLWriteLocalVariableNode) {
+                            probe.tagAs(STATEMENT, null);
+                            probe.tagAs(ASSIGNMENT, null);
+                        }
+                    }
+                } else if (node instanceof SLStatementNode && node.getParent() != null) {
+
+                    SLStatementNode statementNode = (SLStatementNode) node;
+                    if (statementNode.getSourceSection() != null) {
+                        Probe probe = statementNode.probe();
                         probe.tagAs(STATEMENT, null);
-                        probe.tagAs(ASSIGNMENT, null);
-                    }
-                }
-            } else if (node instanceof SLStatementNode && node.getParent() != null) {
 
-                SLStatementNode statementNode = (SLStatementNode) node;
-                if (statementNode.getSourceSection() != null) {
-                    Probe probe = statementNode.probe();
-                    probe.tagAs(STATEMENT, null);
-
-                    if (node instanceof SLWhileNode) {
-                        probe.tagAs(START_LOOP, null);
+                        if (node instanceof SLWhileNode) {
+                            probe.tagAs(START_LOOP, null);
+                        }
                     }
                 }
             }