Title: [692] trunk/jparsetree: down to 9 failures (3 errors), fixed problems with :args in :| etc;
Revision
692
Author
murphee
Date
2007-08-18 23:17:44 -0400 (Sat, 18 Aug 2007)

Log Message

down to 9 failures (3 errors), fixed problems with :args in :| etc;

Modified Paths


Diff

Modified: trunk/jparsetree/lib/jparsetree.rb (691 => 692)


--- trunk/jparsetree/lib/jparsetree.rb	2007-08-17 16:44:36 UTC (rev 691)
+++ trunk/jparsetree/lib/jparsetree.rb	2007-08-19 03:17:44 UTC (rev 692)
@@ -255,17 +255,16 @@
   end
   
   def visitArgsNode(iVisited)
- #   puts "#{iVisited.to_s}, ARGS, #{iVisited.arity.value}"
-    iVisited.args.child_nodes.each {|n| puts n.name} unless iVisited.args == nil
+#    iVisited.args.child_nodes.each {|n| puts n.name} unless iVisited.args == nil
     tempArgs = [:args]
     iVisited.args.child_nodes.each {|n| tempArgs << n.name.to_sym} unless iVisited.args == nil
-    # TODO finish this!
-#p "REST #{iVisited.rest_arg}"
 
+
     opt = nil
     if iVisited.opt_args != nil
      # TODO: is only one opt arg possible?
-     iVisited.opt_args.child_nodes.each {|n| 
+
+    iVisited.opt_args.child_nodes.each {|n| 
        visit(n)
      } 
      opt = @stackElements.pop
@@ -553,20 +552,13 @@
      @stackElements << location([:dasgn_curr, iVisited.name.to_sym], iVisited)
 #      @stackElements << [:lasgn, iVisited.name.to_sym]
     else
-
-#     TODO: not a bug; for some reason, putting :lasgn here causes
-#     less test failures thatn putting :dasgn 
-    @stackElements <<  location([:lasgn, iVisited.name.to_sym, JParseTree.filter_nested_arrays(val)], iVisited)   
-
-      
-      #p "made it past"
+      @stackElements <<  location([:dasgn, iVisited.name.to_sym, JParseTree.filter_nested_arrays(val)], iVisited)
     end
     nil
   end
   
   def visitDRegxNode(iVisited)
     temp = []
-#    p "REGX #{iVisited.child_nodes}"
     iVisited.child_nodes.each {|n|
     # TODO: Bug? how to get rid of :dstr?
        if n
@@ -719,6 +711,7 @@
     args = nil
     blockarg = nil
     if iVisited.args_node
+     puts iVisited.args_node.inspect
      iVisited.args_node.accept(self.to_java_object)    
      args = @stackElements.pop
      
@@ -728,7 +721,6 @@
      end
     end
     args = args.map{|n|
-     # p n
       if n.class == Fixnum
        "*#{iVisited.scope.variables[n]}".to_sym
       else
@@ -766,7 +758,11 @@
       end
       @stackElements << location([:defn, iVisited.name.to_sym,[:scope, the_block ] ], iVisited)
      else
-      @stackElements << location([:defn, iVisited.name.to_sym,[:scope, [:block,[:args], [:nil] ] ] ], iVisited)
+       if args
+         @stackElements << location([:defn, iVisited.name.to_sym,[:scope, [:block,args, [:nil] ] ] ], iVisited)
+       else 
+        @stackElements << location([:defn, iVisited.name.to_sym,[:scope, [:block,[:args], [:nil] ] ] ], iVisited)
+       end
      end
      
 
@@ -1043,14 +1039,35 @@
       args = nil
     end 
     
+    node = [:masgn]
+    if head
+     node << head 
+    end
+    
 #    visit(iVisited.args_node)
      visit(iVisited.value_node)
      val = @stackElements.pop
+#     if args
+#       if val 
+#         , args,  val]
+#       else
+#         @stackElements << location([:masgn, head, args], iVisited) 
+#       end 
+#     else
+#       if val 
+#         @stackElements << location([:masgn, head,  val], iVisited)
+#       else
+#         @stackElements << location([:masgn, head], iVisited) 
+#       end 
+#     end
      if args
-       @stackElements << location([:masgn, head, args,  val], iVisited) 
-     else
-       @stackElements << location([:masgn, head,  val], iVisited) 
+       node << args
      end
+     if val
+       node << val 
+     end
+     @stackElements << location(node, iVisited)
+     
     nil
   end
   
@@ -1231,7 +1248,11 @@
     if body == nil && rescue_node == nil
       @stackElements << location([:resbody, excNodes], iVisited)
     else  if rescue_node == nil
-      @stackElements << location([:resbody, excNodes, JParseTree.filter_nested_arrays(body)], iVisited)
+      if body == :nil
+       @stackElements << location([:resbody, excNodes, [body]], iVisited)
+      else
+        @stackElements << location([:resbody, excNodes, JParseTree.filter_nested_arrays(body)], iVisited)
+      end
      else
      @stackElements << location([:resbody, excNodes, body, JParseTree.filter_nested_arrays(rescue_node)], iVisited)
      end
@@ -1256,9 +1277,9 @@
      end
     else 
      if body != [:nil] && body != nil
-       @stackElements << location([:rescue,  :fuck3, JParseTree.filter_nested_arrays(body), rescueNode, JParseTree.filter_nested_arrays(else_node)], iVisited)
+       @stackElements << location([:rescue,   JParseTree.filter_nested_arrays(body), rescueNode, JParseTree.filter_nested_arrays(else_node)], iVisited)
      else 
-       @stackElements << location([:rescue,  :fuck4, rescueNode, JParseTree.filter_nested_arrays(else_node)], iVisited)
+       @stackElements << location([:rescue,   rescueNode, JParseTree.filter_nested_arrays(else_node)], iVisited)
      end
     end
     nil
@@ -1277,8 +1298,11 @@
     # puts iVisited.to_s
     visit(iVisited.value_node)
     temp = @stackElements.pop
-    
-    @stackElements << location([:return, temp], iVisited)
+    if temp 
+      @stackElements << location([:return, temp], iVisited)
+    else 
+      @stackElements << location([:return], iVisited)
+    end
     nil
   end
   

Modified: trunk/jparsetree/tests/test_jparsetree_20.rb (691 => 692)


--- trunk/jparsetree/tests/test_jparsetree_20.rb	2007-08-17 16:44:36 UTC (rev 691)
+++ trunk/jparsetree/tests/test_jparsetree_20.rb	2007-08-19 03:17:44 UTC (rev 692)
@@ -1,6 +1,7 @@
 require 'test/unit'
 require 'lib/jparsetree'
 
+
 class Examples
   attr_reader :reader
   attr_writer :writer
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to