Permalink
Browse files

cleanups

  • Loading branch information...
vito committed May 19, 2012
1 parent 8e79e04 commit 1bd817c80433bc555f255276d01bf3e8f75d4137
Showing with 18 additions and 12 deletions.
  1. +0 −2 kernel/dynamic.ay
  2. +16 −7 lib/atomy/patterns/quasi_quote.rb
  3. +2 −3 test/bench/fib/fib.ay
View
@@ -4,8 +4,6 @@ use("comparison")
use("control-flow")
use("array")
--- TODO: include file info in nodes, rather than just line
-
Dynvar = class:
initialize(@name, @default = nil) := nil
@@ -281,23 +281,32 @@ def visit(x)
pats = x.send(c).dup
if pats.last && pats.last.splice?
- splice = pats.pop
+ splice = pats.last
+ pats = pats[0..-2]
end
- # TODO: only handle trailing defaults
- defaults, required = pats.partition do |x|
- x.unquote? && x.expression.pattern.is_a?(Default)
+ defaults = 0
+ pats.reverse_each do |p|
+ if p.unquote? && p.expression.pattern.is_a?(Default)
+ defaults += 1
+ else
+ break
+ end
end
+ required = pats.size - defaults
+
@g.dup
@g.send c, 0
- required.each do |p|
+ required.times do |i|
@g.shift_array
- go(p)
+ go(pats[i])
end
- defaults.each.with_index do |d, i|
+ defaults.times do |i|
+ d = pats[required + i]
+
has = @g.new_label
match = @g.new_label
View
@@ -10,12 +10,11 @@ Fixnum open:
else:
if(self == 1)
then: 1
- -- TODO: (- 2) etc. is slow because of send_message
- else: (self - 2) fib-cond + (self - 1) fib-cond
+ else: (- 2) fib-cond + (- 1) fib-cond
0 fib-atomy := 1
1 fib-atomy := 1
-Fixnum fib-atomy := (self - 2) fib-atomy + (self - 1) fib-atomy
+Fixnum fib-atomy := (- 2) fib-atomy + (- 1) fib-atomy
--profiler = Rubinius Profiler Instrumenter new
--profiler start

0 comments on commit 1bd817c

Please sign in to comment.