From: Alexis Laferrière Date: Fri, 17 Jul 2015 14:01:23 +0000 (-0400) Subject: contrib & examples..: update users of `join("")` X-Git-Tag: v0.7.7~21^2~2 X-Git-Url: http://nitlanguage.org?ds=sidebyside contrib & examples..: update users of `join("")` Signed-off-by: Alexis Laferrière --- diff --git a/contrib/jwrapper/src/code_generator.nit b/contrib/jwrapper/src/code_generator.nit index ee0942f..88a8f86 100644 --- a/contrib/jwrapper/src/code_generator.nit +++ b/contrib/jwrapper/src/code_generator.nit @@ -84,10 +84,10 @@ class CodeGenerator if module_name != null then file_out.write "module {module_name}\n" file_out.write("\n") - file_out.write(imports.join("")) + file_out.write(imports.join) file_out.write("\n") - file_out.write(class_content.join("")) - file_out.write(wrappers.join("")) + file_out.write(class_content.join) + file_out.write(wrappers.join) end fun gen_licence: String @@ -117,7 +117,7 @@ class CodeGenerator temp.add("extern class Native{jtype.id} in \"Java\" `\{ {jtype} `\}\n") temp.add("\tsuper JavaObject\n\n") - return temp.join("") + return temp.join end fun gen_unknown_class_header(jtype: JavaType): String @@ -133,7 +133,7 @@ class CodeGenerator temp.add("extern class {nit_type} in \"Java\" `\{ {jtype.to_package_name} `\}\n") temp.add("\tsuper JavaObject\n\nend\n") - return temp.join("") + return temp.join end fun gen_attribute(jid: String, jtype: JavaType): String @@ -219,7 +219,7 @@ class CodeGenerator var temp = new Array[String] - temp.add(comment + nit_signature.join("")) + temp.add(comment + nit_signature.join) # FIXME : This huge `if` block is only necessary to copy primitive arrays as long as there's no better way to do it if comment == "#" then @@ -235,7 +235,7 @@ class CodeGenerator temp.add(" in \"Java\" `\{\n{comment}\t\tself.{jmethod_id}({java_params});\n{comment}\t`\}\n") end - return temp.join("") + return temp.join end end diff --git a/contrib/jwrapper/src/model.nit b/contrib/jwrapper/src/model.nit index d38a7a1..422c051 100644 --- a/contrib/jwrapper/src/model.nit +++ b/contrib/jwrapper/src/model.nit @@ -94,9 +94,9 @@ class JavaType var name if is_primitive_array then # Primitive arrays have a special naming convention - name = "Native" + extern_class_name.join("").capitalized + "Array" + name = "Native" + extern_class_name.join.capitalized + "Array" else - name = "Native" + extern_class_name.join("") + name = "Native" + extern_class_name.join end var nit_type = new NitType(name) diff --git a/contrib/neo_doxygen/src/model/linked_text.nit b/contrib/neo_doxygen/src/model/linked_text.nit index bfdf6a5..83fa3b8 100644 --- a/contrib/neo_doxygen/src/model/linked_text.nit +++ b/contrib/neo_doxygen/src/model/linked_text.nit @@ -112,7 +112,7 @@ abstract class LinkedText var text = self["text"] if text isa JsonArray then - return text.join("") + return text.join else return "UNDEFINED" end diff --git a/contrib/pep8analysis/src/cfg/dot_printer.nit b/contrib/pep8analysis/src/cfg/dot_printer.nit index 0bf39c0..116c91c 100644 --- a/contrib/pep8analysis/src/cfg/dot_printer.nit +++ b/contrib/pep8analysis/src/cfg/dot_printer.nit @@ -23,7 +23,7 @@ redef class BasicBlock do var code_lines = new Array[String] for line in lines do code_lines.add(line.text) - var code = code_lines.join("") + var code = code_lines.join code = code.replace("\n","\\l").replace("\"","\\\"").replace("\\n","|n").replace("/","\\/").replace("\r","") # the last one is a hack diff --git a/examples/rosettacode/balanced_brackets.nit b/examples/rosettacode/balanced_brackets.nit index a1ae476..acf50a0 100644 --- a/examples/rosettacode/balanced_brackets.nit +++ b/examples/rosettacode/balanced_brackets.nit @@ -34,6 +34,6 @@ if args.not_empty then n = args.first.to_i for i in [0..10[ do var a = (['[', ']'] * n) a.shuffle - var b = a.join("") + var b = a.join if is_balanced(b) then print "{b} is well-balanced" else print "{b} is not well-balanced" end diff --git a/examples/rosettacode/one_dimensional_cellular_automata.nit b/examples/rosettacode/one_dimensional_cellular_automata.nit index 77b2ed2..fd3ead4 100644 --- a/examples/rosettacode/one_dimensional_cellular_automata.nit +++ b/examples/rosettacode/one_dimensional_cellular_automata.nit @@ -33,7 +33,7 @@ end var ary = "_###_##_#_#_#_#__#__".chars loop - print ary.join("") + print ary.join var nxt = evolve(ary) if ary == nxt then break ary = nxt diff --git a/lib/dom/xml_entities.nit b/lib/dom/xml_entities.nit index ef080d4..9e6c8bc 100644 --- a/lib/dom/xml_entities.nit +++ b/lib/dom/xml_entities.nit @@ -129,7 +129,7 @@ end class XMLDocument super XMLEntity - redef fun to_s do return children.join("") + redef fun to_s do return children.join end # PCDATA is any kind of non-xml formatted text diff --git a/src/ffi/java.nit b/src/ffi/java.nit index c26fea2..74d421e 100644 --- a/src/ffi/java.nit +++ b/src/ffi/java.nit @@ -606,7 +606,7 @@ redef class MMethod else format.add "V" end - return format.join("") + return format.join end # Similar to `build_c_signature` but adapted to create the signature expected by JNI for C functions diff --git a/tests/example_string.nit b/tests/example_string.nit index 106e498..1264a67 100644 --- a/tests/example_string.nit +++ b/tests/example_string.nit @@ -49,4 +49,4 @@ printn("The value of a is: " + a.to_s + ".\n") # Fiveth way: Join arrays. # Pro: Sometime efficient on complex concatenation. # Con: Crazy. -printn(["The value of a is: ", a.to_s, ".\n"].join("")) +printn(["The value of a is: ", a.to_s, ".\n"].join)