@@ -118,26 +118,32 @@ def visit(node)
118118 when :code
119119 flush_static_block
120120 stripped_code = node [ 1 ] . to_s . gsub ( "-" , "" ) . strip
121- code = if node [ 1 ] . strip . start_with? ( "-" ) then node [ 1 ] . to_s . gsub ( "-" , "" ) else node [ 1 ] . to_s end
122- # Using this to determine if we should throw a StandardError for "invalid" ERB
123- if is_control_struct_start ( stripped_code )
124- @in_control_block = true
125- @output << stripped_code
126- elsif stripped_code == "end"
127- if @in_do_block
128- @in_do_block = false
129- @output << "#{ @inner_buffer } "
130- @output << "end"
131- @output << "#{ @output_tmp_var } << #{ current_lambda } .call(#{ @current_lambda_vars } )"
121+ code = if node [ 1 ] . strip . start_with? ( "-" ) then
122+ node [ 1 ] . to_s . gsub ( "-" , "" )
123+ else
124+ node [ 1 ] . to_s
125+ end
126+ unless stripped_code . empty?
127+ if is_control_struct_start ( stripped_code )
128+ @in_control_block = true
129+ @output << stripped_code
130+ elsif stripped_code == "end"
131+ if @in_do_block
132+ @in_do_block = false
133+ @output << "#{ @inner_buffer } "
134+ @output << "end"
135+ @output << "#{ @output_tmp_var } << #{ current_lambda } .call(#{ @current_lambda_vars } )"
136+ else
137+ @in_control_block = false
138+ @output << "end"
139+ end
140+ elsif is_do_block ( code )
141+ lower_do_block ( code )
132142 else
133- @in_control_block = false
134- @output << "end"
143+ @output << code
135144 end
136- elsif is_do_block ( code )
137- lower_do_block ( code )
138- else
139- @output << code
140145 end
146+ # Using this to determine if we should throw a StandardError for "invalid" ERB
141147 when :newline
142148 else
143149 RubyAstGen ::Logger ::debug ( "Invalid node type: #{ node } " )
0 commit comments