Selaa lähdekoodia

Invert the check

Jens Fischer 6 vuotta sitten
vanhempi
commit
8e0261dfaf
2 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 1 1
      src/core/stringHelper.ml
  2. 1 1
      src/macro/macroApi.ml

+ 1 - 1
src/core/stringHelper.ml

@@ -19,7 +19,7 @@ let capitalize s =
 		Bytes.to_string bytes
 
 let starts_uppercase x =
-	x.[0] = '_' || (x.[0] >= 'A' && x.[0] <= 'Z')
+	if String.length x = 0 then false else x.[0] = '_' || (x.[0] >= 'A' && x.[0] <= 'Z')
 
 let check_uppercase x =
 	if String.length x = 0 then

+ 1 - 1
src/macro/macroApi.ml

@@ -1477,7 +1477,7 @@ let decode_type_def v =
 	) in
 	(* if our package ends with an uppercase letter, then it's the module name *)
 	let pack,name = (match List.rev pack with
-		| last :: l when (Lexer.is_valid_identifier last) && not (is_lower_ident last) -> List.rev l, last
+		| last :: l when StringHelper.starts_uppercase last -> List.rev l, last
 		| _ -> pack, fst name
 	) in
 	(pack, name), tdef, pos