From 6018767c5a503e5751cd5e7fb67dc83a0d0c932b Mon Sep 17 00:00:00 2001 From: Simon Krajewski Date: Mon, 23 Feb 2015 09:46:58 +0100 Subject: [PATCH] [js] do not consider the empty string a valid JS identifier (closes #3908) --- genjs.ml | 2 +- tests/unit/src/unitstd/Map.unit.hx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/genjs.ml b/genjs.ml index 82be4cb3ec8..8c49f0fc927 100644 --- a/genjs.ml +++ b/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' | '$' | '_' -> () diff --git a/tests/unit/src/unitstd/Map.unit.hx b/tests/unit/src/unitstd/Map.unit.hx index f2307cc07ec..08114c46a5a 100644 --- a/tests/unit/src/unitstd/Map.unit.hx +++ b/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() == ''; \ No newline at end of file