Selaa lähdekoodia

[php] remove keywords list duplicate from php.Boot

Aleksandr Kuzmenko 6 vuotta sitten
vanhempi
commit
126204d5c8
1 muutettua tiedostoa jossa 6 lisäystä ja 16 poistoa
  1. 6 16
      std/php/Boot.hx

+ 6 - 16
std/php/Boot.hx

@@ -266,19 +266,8 @@ class Boot {
 
 		var haxeParts = haxeName.split('.');
 		for (part in haxeParts) {
-			switch (part.toLowerCase()) {
-				case "__halt_compiler" | "abstract" | "and" | "array" | "as" | "break" | "callable" | "case" | "catch"
-					| "class" | "clone" | "const" | "continue" | "declare" | "default" | "die" | "do" | "echo" | "else"
-					| "elseif" | "empty" | "enddeclare" | "endfor" | "endforeach" | "endif" | "endswitch" | "endwhile"
-					| "eval" | "exit" | "extends" | "final" | "finally" | "for" | "foreach" | "function" | "global"
-					| "goto" | "if" | "implements" | "include" | "include_once" | "instanceof" | "insteadof"
-					| "interface" | "isset" | "list" | "namespace" | "new" | "or" | "print" | "private" | "protected"
-					| "public" | "require" | "require_once" | "return" | "static" | "switch" | "throw" | "trait" | "try"
-					| "unset" | "use" | "var" | "while" | "xor" | "yield" | "__class__" | "__dir__" | "__file__"
-					| "__function__" | "__line__" | "__method__" | "__trait__" | "__namespace__" | "int" | "float"
-					| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable" | "object" | "fn":
-					part += '_hx';
-				case _:
+			if (isPhpKeyword(part)) {
+				part += '_hx';
 			}
 			phpParts.push(part);
 		}
@@ -287,9 +276,10 @@ class Boot {
 	}
 
 	/**
-	 * Check if the value of `str` is a reserved keyword in PHP
-	 * @see https://www.php.net/manual/en/reserved.keywords.php
-	 */
+		Check if the value of `str` is a reserved keyword in PHP
+		@see https://www.php.net/manual/en/reserved.keywords.php
+	**/
+	@:pure(false)
 	static public function isPhpKeyword(str:String):Bool {
 		//The body of this method is generated by the compiler
 		return false;