Browse Source

[js] always generate proper name for `Array.__name__` and `String.__name__` (fixes #8140)

Alexander Kuzmenko 6 years ago
parent
commit
6cb764fb5a
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/generators/genjs.ml

+ 6 - 4
src/generators/genjs.ml

@@ -1080,10 +1080,12 @@ let generate_class___name__ ctx c =
 	if has_feature ctx "js.Boot.isClass" then begin
 		let p = s_path ctx c.cl_path in
 		print ctx "%s.__name__ = " p;
-		if has_feature ctx "Type.getClassName" then
-			print ctx "\"%s\"" (dot_path c.cl_path)
-		else
-			print ctx "true";
+		match has_feature ctx "Type.getClassName", c.cl_path with
+			| true, _
+			| _, ([], ("Array" | "String")) ->
+				print ctx "\"%s\"" (dot_path c.cl_path)
+			| _ ->
+				print ctx "true";
 		newline ctx;
 	end