@@ -5,10 +5,12 @@ class ErbToRubyTransformer
55 def initialize
66 @parser = Temple ::ERB ::Parser . new
77 @in_control_block = false
8- @output_tmp_var = "self.joern__buffer"
9- @output_tmp_append_func = "self.joern__buffer_append"
8+ @output_tmp_var = "self.joernBuffer"
9+ @output_tmp_append_func = "self.joernBufferAppend"
10+ @joern_template_out_raw = "joernTemplateOutRaw"
11+ @joern_template_out_escape = "joernTemplateOutEscape"
1012 @in_do_block = false
11- @inner_buffer = "joern__inner_buffer "
13+ @inner_buffer = "joernInnerBuffer "
1214 @current_counter = 0
1315 @current_lambda_vars = ""
1416 @output = [ ]
@@ -59,9 +61,9 @@ def visit(node)
5961 when :if
6062 if code . strip . start_with? ( "if" ) || code . strip . start_with? ( "unless" )
6163 template_call = if escape_enabled
62- "joern__template_out_raw"
64+ @joern_template_out_raw
6365 else
64- "joern__template_out_escape"
66+ @joern_template_out_escape
6567 end
6668
6769 if_cond = extract_code_snippet ( ast . children [ 0 ] . location , code )
@@ -81,18 +83,18 @@ def visit(node)
8183 @output << "unless #{ if_cond } "
8284 end
8385 template_call = if escape_enabled
84- "joern__template_out_raw"
86+ @joern_template_out_raw
8587 else
86- "joern__template_out_escape"
88+ @joern_template_out_escape
8789 end
8890 @output << "#{ @output_tmp_append_func } (#{ @output_tmp_var } , #{ template_call } (#{ call } ))"
8991 end
9092 @output << "end"
9193 else
9294 template_call = if escape_enabled then
93- "joern__template_out_raw"
95+ @joern_template_out_raw
9496 else
95- "joern__template_out_escape"
97+ @joern_template_out_escape
9698 end
9799 @output << "#{ @output_tmp_append_func } (#{ @inner_buffer } , #{ template_call } (#{ code } ))"
98100 end
@@ -102,16 +104,16 @@ def visit(node)
102104 lower_do_block ( code )
103105 elsif @in_do_block
104106 template_call = if escape_enabled then
105- "joern__template_out_raw"
107+ @joern_template_out_raw
106108 else
107- "joern__template_out_escape"
109+ @joern_template_out_escape
108110 end
109111 @output << "#{ @output_tmp_append_func } (#{ @inner_buffer } , #{ template_call } (#{ code } ))"
110112 else
111113 template_call = if escape_enabled then
112- "joern__template_out_raw"
114+ @joern_template_out_raw
113115 else
114- "joern__template_out_escape"
116+ @joern_template_out_escape
115117 end
116118 @output << "#{ @output_tmp_append_func } (#{ @output_tmp_var } , #{ template_call } (#{ code } ))"
117119 end
0 commit comments