2
0
Эх сурвалжийг харах

StringHelper.uppercase instead of deprecated String.uppercase

Alexander Kuzmenko 6 жил өмнө
parent
commit
de73cfafb8

+ 10 - 0
src/core/stringHelper.ml

@@ -0,0 +1,10 @@
+let uppercase s =
+	let bytes = Bytes.of_string s in
+	Bytes.iteri
+		(fun idx char ->
+			let code = Char.code char in
+			if 97 <= code && code <= 122 then
+				Bytes.set bytes idx (Char.chr (code - 32))
+		)
+		bytes;
+	Bytes.to_string bytes

+ 3 - 3
src/generators/genphp7.ml

@@ -1370,12 +1370,12 @@ class code_writer (ctx:Common.context) hx_type_path php_name =
 									String.capitalize name
 						and added = ref false
 						and alias = ref (get_type_name type_path) in
-						let alias_upper = ref (String.uppercase !alias) in
+						let alias_upper = ref (StringHelper.uppercase !alias) in
 						let prepend_alias prefix =
 							alias := prefix ^ !alias;
-							alias_upper := String.uppercase !alias
+							alias_upper := StringHelper.uppercase !alias
 						in
-						if !alias_upper = (String.uppercase php_name) then
+						if !alias_upper = (StringHelper.uppercase php_name) then
 							prepend_alias (get_alias_next_part ());
 						while not !added do
 							try