lib/liquidscript/compiler/icr/functions.rb in liquidscript-0.11.0.rc1 vs lib/liquidscript/compiler/icr/functions.rb in liquidscript-0.11.0
- old
+ new
@@ -38,33 +38,29 @@
def compile_function_with_parameters(parameters)
shift :arrow
expressions = _build_set(parameters)
+ expressions.push(*_compile_block)
- if peek?(:lbrace)
- shift :lbrace
- collect_compiles(:rbrace) do
- expressions << compile_expression
- end
- else
- expressions << compile_expression
- end
-
code :function, @set.pop
end
private
def _build_set(parameters = [])
expressions = Liquidscript::ICR::Set.new
expressions.context = Liquidscript::ICR::Context.new
- expressions.context.parents << top.context
+ expressions.context.parent = top.context
expressions[:arguments] = parameters
@set << expressions
parameters.each do |parameter|
- set(parameter).parameter!
+ if parameter[1] == :etc
+ set(parameter[0]).hidden!
+ else
+ set(parameter[0]).parameter!
+ end
end
expressions
end
end