New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
1 participant
@baroquebobcat
Member

baroquebobcat commented Oct 18, 2011

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

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Nov 6, 2011

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>
Member

baroquebobcat commented Nov 6, 2011

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