Permalink
Browse files

(Flash/Js) comment out Std.string optimization (closes #2716)

  • Loading branch information...
1 parent d4af4af commit a2fcda35e09860be77e903e12d068c75de160683 @Simn Simn committed Mar 6, 2014
Showing with 11 additions and 2 deletions.
  1. +2 −2 optimizer.ml
  2. +9 −0 tests/unit/issues/Issue2716.hx
View
@@ -69,7 +69,7 @@ let api_inline ctx c field params p =
Some { eexpr = TConst (TString (if b then "true" else "false")); epos = p; etype = ctx.t.tstring }
| _ ->
None)
- | ([],"Std"),"string",[v] when ctx.com.platform = Js || ctx.com.platform = Flash ->
+(* | ([],"Std"),"string",[v] when ctx.com.platform = Js || ctx.com.platform = Flash ->
let pos = v.epos in
let stringt = ctx.com.basic.tstring in
let stringv = mk (TBinop (Ast.OpAdd, mk (TConst (TString "")) stringt pos, v)) stringt pos in
@@ -85,7 +85,7 @@ let api_inline ctx c field params p =
| TAbstract ({ a_path = [],"Bool" }, []) ->
Some stringv
| _ ->
- None)
+ None) *)
| ([],"Std"),"is",[o;t] | (["js"],"Boot"),"__instanceof",[o;t] when ctx.com.platform = Js ->
let mk_local ctx n t pos = mk (TLocal (try PMap.find n ctx.locals with _ -> add_local ctx n t)) t pos in
@@ -0,0 +1,9 @@
+package unit.issues;
+import unit.Test;
+
+class Issue2716 extends Test {
+ function test() {
+ eq("null", Std.string(['foo', null][Std.random(1)+1]));
+ eq("null", Std.string(['foo'][Std.random(1)+1]));
+ }
+}

0 comments on commit a2fcda3

Please sign in to comment.