Skip to content

Instantly share code, notes, and snippets.

@Codcore
Last active August 29, 2015 14:22
Show Gist options
  • Save Codcore/bf2d894570398db07ea1 to your computer and use it in GitHub Desktop.
Save Codcore/bf2d894570398db07ea1 to your computer and use it in GitHub Desktop.
$view = "view"
class View
  def initialize()
    @name = "Andrew"
  end

  ecr_file("#{__DIR__}/#{$view}.ecr")
end

string = StringIO.new
View.new.to_s(string)
puts string

output:

Error in ./examples/code.cr:16: instantiating 'View#to_s(StringIO)'

 View.new.to_s(string)
          ^~~~

in macro 'embed_ecr' /usr/lib/crystal/ecr/macros.cr:1, line 1:

  1.   {{ run("ecr/process", (((((::String::Builder.new(69)) << "/home/kavachaj/crystal-projects/Amethyst/examples") << "/") << $view) << ".ecr").to_s, "__io__") }}

  {{ run("ecr/process", (((((::String::Builder.new(69)) << "/home/kavachaj/crystal-projects/Amethyst/examples") << "/") << $view) << ".ecr").to_s, "__io__") }}
  ^

expanding macro
in macro 'embed_ecr' /usr/lib/crystal/ecr/macros.cr:1, line 1:

  1.   {{ run("ecr/process", (((((::String::Builder.new(69)) << "/home/kavachaj/crystal-projects/Amethyst/examples") << "/") << $view) << ".ecr").to_s, "__io__") }}

  {{ run("ecr/process", (((((::String::Builder.new(69)) << "/home/kavachaj/crystal-projects/Amethyst/examples") << "/") << $view) << ".ecr").to_s, "__io__") }}
                                               ^~~

undefined macro method TypeNode#new'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment