Browse Source

[php] make goto a reserved word (for real this time) (closes #4337)

Simon Krajewski 10 years ago
parent
commit
8ce9125c8f
2 changed files with 18 additions and 2 deletions
  1. 5 2
      genphp.ml
  2. 13 0
      tests/unit/src/unit/issues/Issue4337.hx

+ 5 - 2
genphp.ml

@@ -307,8 +307,11 @@ let is_keyword n =
 	| "include_once" | "isset" | "list" | "namespace" | "print" | "require" | "require_once"
 	| "unset" | "use" | "__function__" | "__class__" | "__method__" | "final"
 	| "php_user_filter" | "protected" | "abstract" | "__set" | "__get" | "__call"
-	| "clone" | "instanceof" | "break" | "case" | "class" | "continue" | "default" | "do" | "else" | "extends" | "for" | "function" | "if" | "new" | "return" | "static" | "switch" | "var" | "while" | "interface" | "implements" | "public" | "private" | "try" | "catch" | "throw" -> true
-	| "goto"
+	| "clone" | "instanceof" | "break" | "case" | "class" | "continue" | "default"
+	| "do" | "else" | "extends" | "for" | "function" | "if" | "new" | "return"
+	| "static" | "switch" | "var" | "while" | "interface" | "implements" | "public"
+	| "private" | "try" | "catch" | "throw" | "goto"
+		-> true
 	| _ -> false
 
 let s_ident n =

+ 13 - 0
tests/unit/src/unit/issues/Issue4337.hx

@@ -0,0 +1,13 @@
+package unit.issues;
+
+class Issue4337 extends Test {
+
+	function test() {
+		eq("goto", goto());
+	}
+
+	static function goto(){
+		return "goto";
+	}
+
+}