Skip to content

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

Open

Description

@baroquebobcat
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.

Activity

  1. baroquebobcat commented on Nov 6, 2011

    @baroquebobcat
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions