def_edb can't be called in a quote block of a macro #152

Open
baroquebobcat opened this Issue Oct 18, 2011 · 1 comment

Projects

None yet

1 participant

@baroquebobcat
Member
macro def foo bar
  quote do
    def_edb `bar`, "something"
  end
end

causes

NoMethodError: undefined method `name' for Unquote
     FunctionalCall(n):Mirah::AST::Unquote

to be raised because def_edb is being expanded before foo is.

https://github.com/mirah/mirah/blob/master/lib/mirah/plugin/edb.rb#L19

I'm not sure how to fix this behavior. I figure we either need def_edb to be unquote tolerate, or to expand it after the macro it is in.

I don't like the idea of making it unquote proof as much because it means that that's one more thing a plugin writer would have to worry about, but if it's simpler maybe we could start there.

@baroquebobcat
Member

It also can't be called in a closure.

def foo r:Runnable
  r.run
end

foo do
  def_edb run, 'aoeu.edb'  
end

gets you:

undefined method `defining_class' for #<Mirah::AST::Block:0x32007142>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment