lib/liquidscript/compiler/icr/helpers.rb in liquidscript-0.7.6 vs lib/liquidscript/compiler/icr/helpers.rb in liquidscript-0.7.7

- old
+ new

@@ -12,9 +12,28 @@ end def code(type, *args) Liquidscript::ICR::Code.new type, *args end + + def value_expect(v, &default) + out = expect \ + :lparen => action { compile_call(v) }, + :equal => action { compile_assignment(v) }, + :prop => action { compile_property(v) }, + :lbrack => action { compile_access(v) }, + [:binop, + :minus, + :plus] => action { compile_binop(v) }, + :unop => action { |o| code :op, v, o }, + :_ => default || action { v } + + if out != v + value_expect(out) + else + out + end + end end end end end