Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Jan 4, 2012
1 parent fee8695 commit d804800
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 11 additions & 5 deletions lib/atomy/patterns/quasi_quote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,19 @@ def visit(x)
x.unquote? && x.expression.to_pattern.is_a?(Default)
end

# do we care about size?
inexact = splice || !defaults.empty?

@g.dup
@g.send c, 0
@g.dup
@g.send :size, 0
@g.push_int required.size
@g.send(splice || !defaults.empty? ? :>= : :==, 1)
@g.gif popmis2

unless inexact && required.empty?
@g.dup
@g.send :size, 0
@g.push_int required.size
@g.send(inexact ? :>= : :==, 1)
@g.gif popmis2
end

required.each do |p|
@g.shift_array
Expand Down
8 changes: 5 additions & 3 deletions lib/atomy/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ def self.send_message(recv, ctx, name, *args, &blk)
else
scope = ctx
while scope
if scope.module.respond_to?(name, true) &&
!scope.module.class.method_defined?(name)
return scope.module.__send__(name, *args, &blk)
mod = scope.module

if mod.respond_to?(name, true) &&
!mod.class.method_defined?(name)
return mod.__send__(name, *args, &blk)
end

scope = scope.parent
Expand Down

0 comments on commit d804800

Please sign in to comment.