src/rubyjs/compiler.rb in rubyjs-0.7.1 vs src/rubyjs/compiler.rb in rubyjs-0.8.0

- old
+ new

@@ -1310,21 +1310,34 @@ # EXPRESSION # # String interpolation # def process_dstr(exp) - pre_str = exp.shift - res = without_result do + arr = [] + arr << exp.shift.inspect + + without_result do want_expression do - # NOTE: - # We use +to_s+, and the + operator to - # build the interpolated string. - @model.add_method_call(to_s = @model.encode_method("to_s")) - "(" + ([pre_str.inspect] + exp.map {|e| "(" + process(e) + ").#{to_s}()"}).join(" + ") + ")" + exp.each {|e| arr << "(" + process(e) + ")" } end end + exp.clear + resultify("(" + arr.join(" + ") + ")") + end + + def process_evstr(exp) + e = exp.shift + + @model.add_method_call(to_s = @model.encode_method("to_s")) + + res = without_result do + want_expression do + "(" + process(e) + ").#{to_s}()" + end + end + resultify(res) end # # EXPRESSION @@ -1827,10 +1840,10 @@ if params.nil? # Case 1: {}: Any number of arguments may be passed arity = -1 fun_str << "function(){" - elsif params == :zero_arguments + elsif params == 0 # Case 2: {||}: Zero arguments arity = 0 fun_str << "function(){" elsif params.first == :masgn # Case 3: {|i,j|}: Multiple arguments (multiple assignment)