|
From: <caw...@us...> - 2007-04-04 16:27:59
|
Revision: 2281
http://svn.sourceforge.net/rubyeclipse/?rev=2281&view=rev
Author: cawilliams
Date: 2007-04-04 09:27:57 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
cleanup code (particularly calls to System.out.println())
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/TypeInferenceVisitor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/AttributeLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2007-04-04 16:22:14 UTC (rev 2280)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2007-04-04 16:27:57 UTC (rev 2281)
@@ -252,9 +252,6 @@
* @param occurrences
*/
private void pushLocalVarRefs(Node root, Node orig, List<ISourcePosition> occurrences) {
- // System.out.println("Finding occurrences for a local variable " +
- // orig.toString());
-
// Find the search space
Node searchSpace = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(root, orig.getPosition().getStartOffset(), new INodeAcceptor() {
public boolean doesAccept(Node node) {
@@ -297,9 +294,6 @@
* @param occurrences
*/
private void pushDVarRefs(Node root, Node orig, List<ISourcePosition> occurrences) {
- // System.out.println("Finding occurrences for a local variable " +
- // orig.toString());
-
// Find the search space
Node searchSpace = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(root, orig.getPosition().getStartOffset(), new INodeAcceptor() {
public boolean doesAccept(Node node) {
@@ -340,9 +334,6 @@
* @param occurrences
*/
private void pushInstVarRefs(Node root, Node orig, List<ISourcePosition> occurrences) {
- // System.out.println("Finding occurrences for an instance variable " +
- // orig.toString() );
-
Node searchSpace = determineSearchSpace(root, orig);
// Finalize searchSpace because Java's scoping rules are the awesome
@@ -411,9 +402,6 @@
* @param occurrences
*/
private void pushClassVarRefs(Node root, Node orig, List<ISourcePosition> occurrences) {
- // System.out.println("Finding occurrences for an instance variable " +
- // orig.toString() );
-
Node searchSpace = determineSearchSpace(root, orig);
// Finalize searchSpace because Java's scoping rules are the awesome
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java 2007-04-04 16:22:14 UTC (rev 2280)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java 2007-04-04 16:27:57 UTC (rev 2281)
@@ -183,7 +183,6 @@
List<Node> searchResults = ScopedNodeLocator.Instance().findNodesInScope(searchSpace, new INodeAcceptor() {
public boolean doesAccept(Node node) {
String name = getLocalVarRefName(node, finalSearchSpace);
-// System.out.println("Matching name" + name);
return ( name != null && name.equals(origName));
}
});
@@ -192,8 +191,6 @@
for ( Node searchResult : searchResults ) {
references.add(getPositionOfName(searchResult, searchSpace));
}
-
-// System.out.println("Searching search space " + searchSpace.toString() + searchSpace.getPosition().toString() );
}
private void log(String string) {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/TypeInferenceVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/TypeInferenceVisitor.java 2007-04-04 16:22:14 UTC (rev 2280)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/TypeInferenceVisitor.java 2007-04-04 16:27:57 UTC (rev 2281)
@@ -23,26 +23,10 @@
// TODO: init globalScope to null, push in first non-null node as
// globalScope
public TypeInferenceVisitor( Node rootNode ) {
- System.out.println("Instantiating new TypeInferenceVisitor with root node " + stringifyNode(rootNode) );
globalScope = new Scope( rootNode, null );
currentScope = globalScope;
}
-
- public Instruction handleNode(Node iVisited) {
-
-// if ( iVisited != null )
-// {
-// String pos = "";
-// String cls = "";
-// if ( iVisited.getPosition() != null ) pos = Integer.toString(iVisited.getPosition().getStartLine());
-// if ( iVisited.getClass() != null ) cls = iVisited.getClass().getName();
-// System.out.println("Visiting " + iVisited.getClass().getSimpleName() + "\tat line " + pos + " of class " + cls );
-// System.out.println(" - Spanning " + iVisited.getPosition().getStartOffset() + "-" + iVisited.getPosition().getEndOffset());
-// }
- return super.handleNode(iVisited);
- }
-
/**
* Visit a ModuleNode, and extract its local variables from the embedded
* body ScopeNode
@@ -106,7 +90,6 @@
* @return newly pushed Scope
*/
private Scope pushScope( Node node ) {
- System.out.println("Pushing Scope for Node: " + stringifyNode(node) );
Scope newScope = new Scope( node, currentScope );
currentScope = newScope;
return newScope;
@@ -114,8 +97,7 @@
// TODO: how to tell when to do this?
// TODO: perhaps model IndexUpdater rather than InOrderVisitor
- private void popScope()
- {
+ private void popScope() {
currentScope = currentScope.getParentScope();
}
@@ -125,9 +107,7 @@
*/
public Instruction visitCallNode(CallNode iVisited) {
Variable var = getVariableByVarNode( iVisited.getReceiverNode() );
- if ( var != null )
- {
-// System.out.println("Call: " + var.getName() + "." + iVisited.getName() );
+ if ( var != null ) {
// TODO: add call to list
}
return super.visitCallNode(iVisited);
@@ -159,7 +139,6 @@
* Local assignment may provide a concrete type from the rvalue
*/
public Instruction visitLocalAsgnNode(LocalAsgnNode iVisited) {
-// System.out.println("Visiting LocalAsgnNode: " + stringifyNode(iVisited));
Variable var = currentScope.getLocalVariableByCount( iVisited.getIndex() );
if ( var == null )
{
@@ -214,32 +193,16 @@
}
}
}
-
- // Print list of types now assoc'd with the var
- System.out.print("[");
- for ( ITypeGuess guess : var.getTypeGuesses() )
- {
- System.out.print(guess.getType() + ",");
- }
- System.out.print("]");
-
-
- System.out.println("");
return super.visitLocalAsgnNode(iVisited);
}
-
-
-
-
/**
* Similar to Node.toString(),. but with the beginning line number.
*
* @param node
* @return
*/
- private String stringifyNode(Node node)
- {
+ private String stringifyNode(Node node) {
return node.getClass().getName() + "@ :" + node.getPosition().getStartLine();
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/AttributeLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/AttributeLocator.java 2007-04-04 16:22:14 UTC (rev 2280)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/AttributeLocator.java 2007-04-04 16:27:57 UTC (rev 2281)
@@ -78,9 +78,7 @@
}
if ( argNode instanceof StrNode ) {
attributes.add(attrPrefix + ((StrNode)argNode).getValue() );
- }
- System.out.println(argNode.getClass().getName());
-
+ }
}
}
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java 2007-04-04 16:22:14 UTC (rev 2280)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java 2007-04-04 16:27:57 UTC (rev 2281)
@@ -48,21 +48,15 @@
/**
* Searches via InOrderVisitor for the closest precursor.
*/
- public Instruction handleNode(Node iVisited)
- {
-//todo: This will include nodes that envelop nodeStart, not only those starting strictly before it.
+ public Instruction handleNode(Node iVisited) {
+// TODO This will include nodes that envelop nodeStart, not only those starting strictly before it.
// If this behavior is unwanted, remove the || (iVisited.getPosition().getStartOffset() <= offset)
-// in the conditional
-
- if (( iVisited.getPosition().getEndOffset() <= offset) || (iVisited.getPosition().getStartOffset() <= offset ))
- {
- if ( acceptor.doesAccept( iVisited ) )
- {
-// System.out.println("Recording accepted node: " + iVisited.getClass().getSimpleName() + "@" + iVisited.getPosition().getStartOffset() + ".." + iVisited.getPosition().getEndOffset() );
+// in the conditional
+ if (( iVisited.getPosition().getEndOffset() <= offset) || (iVisited.getPosition().getStartOffset() <= offset )) {
+ if ( acceptor.doesAccept( iVisited ) ) {
locatedNode = iVisited;
}
- }
-
+ }
return super.handleNode(iVisited);
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java 2007-04-04 16:22:14 UTC (rev 2280)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/OffsetNodeLocator.java 2007-04-04 16:27:57 UTC (rev 2281)
@@ -58,14 +58,12 @@
private Node refine(Node node) {
// If the search returned an ArgsNode, try to find the specific ArgumentNode matched
- if ( node instanceof ArgsNode )
- {
+ if ( node instanceof ArgsNode ) {
ArgsNode argsNode = (ArgsNode)node;
if ( argsNode.getArgsCount() > 0 ) {
for (Iterator iter = argsNode.getArgs().childNodes().iterator(); iter.hasNext();) {
ArgumentNode argNode = (ArgumentNode) iter.next();
if ( nodeDoesSpanOffset(argNode, offset) ) {
-// System.out.println("Refining " + node.getClass().getSimpleName() + "["+node.getPosition().getStartOffset() + ".." + node.getPosition().getEndOffset() + "] to " + argNode.getClass().getSimpleName() + "["+argNode.getPosition().getStartOffset() + ".." + argNode.getPosition().getEndOffset() + "]");
return argNode;
}
}
@@ -79,9 +77,7 @@
* If so, see if it spans it more closely than any previously identified spanning node.
* If so, record it as the most closely spanning yet.
*/
- public Instruction handleNode(Node iVisited)
- {
-// System.out.println("Looking for node at offset, checking: " + iVisited.getClass().getName() + "[" + iVisited.getPosition().getStartOffset() + ".." + iVisited.getPosition().getEndOffset() + "]" );
+ public Instruction handleNode(Node iVisited) {
// Skip the NewlineNode since its position is very unaccurate
if (!(iVisited instanceof NewlineNode) && nodeDoesSpanOffset(iVisited, offset)) {
//note: careful... should this be <=? I think so; since it traverses in-order, this should find the "most specific" closest node. i.e.
@@ -93,7 +89,7 @@
}
}
- //todo: Since we are moving in order, if a spanning node has been located, and the current node does
+ // TODO Since we are moving in order, if a spanning node has been located, and the current node does
// not span, we can effectively return early since no subsequent nodes should span. Not doing this
// now, just in case InOrderVisitor proves to not quite be in-order (i.e. offsets reported are off.)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|