luke-gru / riml

Riml is a subset of VimL with some nice added features. It compiles to plain VimL.
MIT License
224 stars 6 forks source link

If case nested inside unless throws error #15

Closed dsawardekar closed 10 years ago

dsawardekar commented 11 years ago

The unless block doesn't support nesting if statements. Consider this,

unless 'a' == 'b'
  if 1 == 2
    echo 'nope'
  else
    echo 'yup'
  end
end

This code doesn't compile, instead produces the following error.

/home/dms/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/riml-0.3.1/lib/nodes.rb:31:in `method_missing': undefined method `non_nested?' for #<Riml::UnlessNode:0x00000001e0afa0> (NoMethodError)

This is not a major bug since such unless blocks are usually at the top of a function to return early. I needed to do some additional checks in one particular scenario when I came across this bug. Switching to an if with a negative equality works.

luke-gru commented 10 years ago

This is fixed in 0.3.2.Thanks!