Skip to content
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
Open

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

baroquebobcat opened this issue Oct 18, 2011 · 1 comment
Labels

Comments

@baroquebobcat
Copy link
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
Copy link
Member Author

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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant