lib/liquidscript/compiler/icr/functions.rb in liquidscript-0.6.3 vs lib/liquidscript/compiler/icr/functions.rb in liquidscript-0.6.4

- old
+ new

@@ -11,21 +11,21 @@ end # Just in case there is a property named 'class' or 'module' v = expect [:identifier, :class, :module] => property - value_expect(v) + v end def compile_access(body) shift :lbrack key = compile_vexpression shift :rbrack v = code :access, body, key - value_expect(v) + v end def compile_call(subject) shift :lparen @@ -34,24 +34,32 @@ end arguments = collect_compiles :expression, :rparen, :comma => action.shift - code :call, subject, *arguments + call = code :call, subject, *arguments + call end protected def value_expect(v, &default) - expect :lparen => action { compile_call(v) }, + 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