Răsfoiți Sursa

[js] do not consider the empty string a valid JS identifier (closes #3908)

Simon Krajewski 10 ani în urmă
părinte
comite
6018767c5a
2 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 1 1
      genjs.ml
  2. 2 2
      tests/unit/src/unitstd/Map.unit.hx

+ 1 - 1
genjs.ml

@@ -112,7 +112,7 @@ let kwds2 =
 	h
 
 let valid_js_ident s =
-	try
+	String.length s > 0 && try
 		for i = 0 to String.length s - 1 do
 			match String.unsafe_get s i with
 			| 'a'..'z' | 'A'..'Z' | '$' | '_' -> ()

+ 2 - 2
tests/unit/src/unitstd/Map.unit.hx

@@ -149,7 +149,6 @@ map.exists(c) == true;
 map.get(b) == null;
 
 // [] access
-/*
 var map = new Map();
 map["foo"] == null;
 map["foo"] = 12;
@@ -165,4 +164,5 @@ map[(function(s) return s + "o")("fo")] == 1;
 map["bar"] = map["foo"] = 9;
 map["bar"] == 9;
 map["foo"] == 9;
-*/
+
+['' => ''].keys().next() == '';