 
   """
   defmacro scope(path, alias, options, do: context) do
-    alias = Macro.expand(alias, %{__CALLER__ | function: {:init, 1}})
+    alias = expand_alias(alias, __CALLER__)
 
     options = quote do
       unquote(options)

  See `pipeline/2` for more information.
  """
  defmacro plug(plug, opts \\ []) do
    runtime? = Phoenix.plug_init_mode() == :runtime

    plug =
      if runtime? do
        expand_alias(plug, __CALLER__)
      else
        plug
      end

    opts =
      if runtime? and Macro.quoted_literal?(opts) do
        Macro.prewalk(opts, &expand_alias(&1, __CALLER__))
      else
        opts
      end

    quote do
      if pipeline = @phoenix_pipeline do

        raise "cannot define plug at the router level, plug must be defined inside a pipeline"
      end
    end
  end

  defp expand_plug_and_opts(plug, opts, caller) do
    runtime? = Phoenix.plug_init_mode() == :runtime

    plug =
      if runtime? do
        expand_alias(plug, caller)
      else
        plug
      end

    opts =
      if runtime? and Macro.quoted_literal?(opts) do
        Macro.prewalk(opts, &expand_alias(&1, caller))
      else
        opts
      end

    {plug, opts}
  end

  defp expand_alias({:__aliases__, _, _} = alias, env),
