|
From: <caw...@us...> - 2007-03-26 15:28:50
|
Revision: 2229
http://svn.sourceforge.net/rubyeclipse/?rev=2229&view=rev
Author: cawilliams
Date: 2007-03-26 08:28:48 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/NodeUtil.java
Deleted: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/NodeUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/NodeUtil.java 2007-03-26 14:17:18 UTC (rev 2228)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/NodeUtil.java 2007-03-26 15:28:48 UTC (rev 2229)
@@ -1,14 +0,0 @@
-package org.rubypeople.rdt.internal.core.parser;
-
-import org.jruby.ast.Node;
-import org.jruby.lexer.yacc.ISourcePosition;
-
-public class NodeUtil {
-
- private NodeUtil() {}
-
- public static String getSource(String contents, Node node) {
- ISourcePosition pos = node.getPosition();
- return contents.substring(pos.getStartOffset(), pos.getEndOffset());
- }
-}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java 2007-03-26 14:17:18 UTC (rev 2228)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java 2007-03-26 15:28:48 UTC (rev 2229)
@@ -19,8 +19,8 @@
import org.rubypeople.rdt.core.compiler.CategorizedProblem;
import org.rubypeople.rdt.core.compiler.IProblem;
import org.rubypeople.rdt.internal.core.parser.Error;
-import org.rubypeople.rdt.internal.core.parser.NodeUtil;
import org.rubypeople.rdt.internal.core.parser.Warning;
+import org.rubypeople.rdt.internal.core.util.ASTUtil;
public abstract class RubyLintVisitor extends AbstractVisitor {
@@ -33,7 +33,7 @@
}
protected String getSource(Node node) {
- return NodeUtil.getSource(contents, node);
+ return ASTUtil.getSource(contents, node);
}
public List<CategorizedProblem> getProblems() {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java 2007-03-26 14:17:18 UTC (rev 2228)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java 2007-03-26 15:28:48 UTC (rev 2229)
@@ -7,12 +7,16 @@
import org.jruby.ast.ArgsNode;
import org.jruby.ast.ArgumentNode;
+import org.jruby.ast.AttrAssignNode;
+import org.jruby.ast.ClassVarAsgnNode;
import org.jruby.ast.Colon2Node;
import org.jruby.ast.ConstNode;
import org.jruby.ast.DStrNode;
import org.jruby.ast.FalseNode;
import org.jruby.ast.FixnumNode;
+import org.jruby.ast.GlobalAsgnNode;
import org.jruby.ast.HashNode;
+import org.jruby.ast.InstAsgnNode;
import org.jruby.ast.ListNode;
import org.jruby.ast.LocalAsgnNode;
import org.jruby.ast.NilNode;
@@ -22,6 +26,7 @@
import org.jruby.ast.TrueNode;
import org.jruby.ast.ZArrayNode;
import org.jruby.ast.types.INameNode;
+import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.parser.StaticScope;
public abstract class ASTUtil {
@@ -167,4 +172,15 @@
return name.toString();
}
+ public static boolean isAssignment(Node node) {
+ return (node instanceof LocalAsgnNode) || (node instanceof ClassVarAsgnNode)
+ || (node instanceof InstAsgnNode) || (node instanceof GlobalAsgnNode)
+ || (node instanceof AttrAssignNode);
+ }
+
+ public static String getSource(String contents, Node node) {
+ ISourcePosition pos = node.getPosition();
+ return contents.substring(pos.getStartOffset(), pos.getEndOffset());
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|