001: /*BEGIN_COPYRIGHT_BLOCK
002: *
003: * Copyright (c) 2001-2007, JavaPLT group at Rice University (javaplt@rice.edu)
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are met:
008: * * Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: * * Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
014: * names of its contributors may be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
021: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
022: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
023: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: *
029: * This software is Open Source Initiative approved Open Source Software.
030: * Open Source Initative Approved is a trademark of the Open Source Initiative.
031: *
032: * This file is part of DrJava. Download the current version of this project
033: * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
034: *
035: * END_COPYRIGHT_BLOCK*/
036:
037: package edu.rice.cs.drjava.model.repl;
038:
039: import koala.dynamicjava.interpreter.context.*;
040:
041: /** Extension of EvaluationVisitorExtension that notifies InterpreterJVM every time a variable assignment is made.
042: * (But this functionality has been commented out.)
043: * This class is loaded in the Interpreter JVM, not the Main JVM.
044: * (Do not use DrJava's config framework here.)
045: *
046: * @version $Id: DebugEvaluationVisitor.java 4255 2007-08-28 19:17:37Z mgricken $
047: */
048: public class DebugEvaluationVisitor extends EvaluationVisitorExtension {
049:
050: /** The context associated with this visitor. */
051: protected Context _context;
052:
053: /** The name of the interpreter enclosing this visitor. */
054: protected final String _name;
055:
056: /** Creates a new debug visitor.
057: * @param ctx the context
058: * @param name the name of the enclosing interpreter
059: */
060: public DebugEvaluationVisitor(Context ctx, String name) {
061: super (ctx);
062: _context = ctx;
063: _name = name;
064: }
065:
066: // /** Visits the node, as per the superclass, then notifies the interpreter that something has been assigned.
067: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
068: // *
069: // * @param node the node to visit
070: // */
071: // protected void _notifyAssigned(Expression e) {
072: // InterpreterJVM.ONLY.notifyInterpreterAssignment(_name);
073: // }
074:
075: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
076: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
077: // *
078: // * @param node the node to visit
079: // * @return the result of calling this method on the superclass
080: // */
081: // public Object visit(SimpleAssignExpression node) {
082: // Object result = super.visit(node);
083: // _notifyAssigned(node.getLeftExpression());
084: // return result;
085: // }
086:
087: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
088: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
089: // *
090: // * @param node the node to visit
091: // * @return the result of calling this method on the superclass
092: // */
093: // public Object visit(AddAssignExpression node) {
094: // Object result = super.visit(node);
095: // _notifyAssigned(node.getLeftExpression());
096: // return result;
097: // }
098:
099: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
100: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
101: // *
102: // * @param node the node to visit
103: // * @return the result of calling this method on the superclass
104: // */
105: // public Object visit(SubtractAssignExpression node) {
106: // Object result = super.visit(node);
107: // _notifyAssigned(node.getLeftExpression());
108: // return result;
109: // }
110:
111: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
112: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
113: // *
114: // * @param node the node to visit
115: // * @return the result of calling this method on the superclass
116: // */
117: // public Object visit(MultiplyAssignExpression node) {
118: // Object result = super.visit(node);
119: // _notifyAssigned(node.getLeftExpression());
120: // return result;
121: // }
122:
123: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
124: // * Not currently necessary, since variables aren't copied bac until the thread is resumed.
125: // *
126: // * @param node the node to visit
127: // * @return the result of calling this method on the superclass
128: // */
129: // public Object visit(DivideAssignExpression node) {
130: // Object result = super.visit(node);
131: // _notifyAssigned(node.getLeftExpression());
132: // return result;
133: // }
134:
135: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
136: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
137: // *
138: // * @param node the node to visit
139: // * @return the result of calling this method on the superclass
140: // */
141: // public Object visit(RemainderAssignExpression node) {
142: // Object result = super.visit(node);
143: // _notifyAssigned(node.getLeftExpression());
144: // return result;
145: // }
146:
147: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
148: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
149: // *
150: // * @param node the node to visit
151: // * @return the result of calling this method on the superclass
152: // */
153: // public Object visit(BitAndAssignExpression node) {
154: // Object result = super.visit(node);
155: // _notifyAssigned(node.getLeftExpression());
156: // return result;
157: // }
158:
159: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
160: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
161: // *
162: // * @param node the node to visit
163: // * @return the result of calling this method on the superclass
164: // */
165: // public Object visit(ExclusiveOrAssignExpression node) {
166: // Object result = super.visit(node);
167: // _notifyAssigned(node.getLeftExpression());
168: // return result;
169: // }
170:
171: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
172: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
173: // *
174: // * @param node the node to visit
175: // * @return the result of calling this method on the superclass
176: // */
177: // public Object visit(BitOrAssignExpression node) {
178: // Object result = super.visit(node);
179: // _notifyAssigned(node.getLeftExpression());
180: // return result;
181: // }
182:
183: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
184: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
185: // *
186: // * @param node the node to visit
187: // * @return the result of calling this method on the superclass
188: // */
189: // public Object visit(ShiftLeftAssignExpression node) {
190: // Object result = super.visit(node);
191: // _notifyAssigned(node.getLeftExpression());
192: // return result;
193: // }
194:
195: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
196: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
197: // *
198: // * @param node the node to visit
199: // * @return the result of calling this method on the superclass
200: // */
201: // public Object visit(ShiftRightAssignExpression node) {
202: // Object result = super.visit(node);
203: // _notifyAssigned(node.getLeftExpression());
204: // return result;
205: // }
206:
207: // /** Notifies the InterpreterJVM that an assignment has been made and delegates to the superclass.
208: // * Not currently necessary, since variables aren't copied back until the thread is resumed.
209: // *
210: // * @param node the node to visit
211: // * @return the result of calling this method on the superclass
212: // */
213: // public Object visit(UnsignedShiftRightAssignExpression node) {
214: // Object result = super.visit(node);
215: // _notifyAssigned(node.getLeftExpression());
216: // return result;
217: // }
218: }
|