Browse Source

Add new JS keywords, remove non-keywords.

Fixes #2182.
Bruno Garcia 12 years ago
parent
commit
b95708b1fa
1 changed files with 11 additions and 6 deletions
  1. 11 6
      genjs.ml

+ 11 - 6
genjs.ml

@@ -74,13 +74,18 @@ let s_path ctx = if ctx.js_flatten then flat_path else dot_path
 let kwds =
 	let h = Hashtbl.create 0 in
 	List.iter (fun s -> Hashtbl.add h s ()) [
-		"abstract"; "as"; "boolean"; "break"; "byte"; "case"; "catch"; "char"; "class"; "continue"; "const";
-		"debugger"; "default"; "delete"; "do"; "double"; "else"; "enum"; "export"; "extends"; "false"; "final";
-		"finally"; "float"; "for"; "function"; "goto"; "if"; "implements"; "import"; "in"; "instanceof"; "int";
-		"interface"; "is"; "long"; "namespace"; "native"; "new"; "null"; "package"; "private"; "protected";
-		"public"; "return"; "short"; "static"; "super"; "switch"; "synchronized"; "this"; "throw"; "throws";
-		"transient"; "true"; "try"; "typeof"; "use"; "var"; "void"; "volatile"; "while"; "window"; "with";
+		(* JS reserved words: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words *)
+		"break"; "case"; "catch"; "class"; "continue"; "debugger"; "default"; "delete"; "do";
+		"else"; "enum"; "export"; "extends"; "finally"; "for"; "function"; "if"; "implements";
+		"import"; "in"; "instanceof"; "interface"; "let"; "new"; "package"; "private"; "protected";
+		"public"; "return"; "static"; "super"; "switch"; "this"; "throw"; "try"; "typeof"; "var";
+		"void"; "while"; "with"; "yield";
+
+		(* Identifiers Haxe reserves to make the JS output cleaner. *)
+		"window";
 	];
+
+
 	h
 
 let valid_js_ident s =