Skip to content

Commit

Permalink
do not try to be too smart about inlining constructors (see HaxeFound…
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Mar 5, 2015
1 parent fdcca00 commit 4806487
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion optimizer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ let inline_constructors ctx e =
in
let rec skip_to_var e = match e.eexpr with
| TLocal v when v.v_id < 0 -> Some v
| TCast(e1,None) | TMeta(_,e1) | TParenthesis(e1) -> skip_to_var e1
(* | TCast(e1,None) | TMeta(_,e1) | TParenthesis(e1) -> skip_to_var e1 *)
| _ -> None
in
let rec find_locals e =
Expand Down
25 changes: 25 additions & 0 deletions tests/unit/src/unit/issues/Issue3967.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package unit.issues;

private class A {
public var a:String;
public inline function new(a:String) {
this.a = a;
}

public function test() { return a; }
}

class Issue3967 extends Test {
function testAndy() {
var a = ["a", "b"];
var b = a.copy();
eq("a", b[0]);
eq("b", b[1]);
f(a == b);
}

//function testNicolas() {
//var x:{ var test(default,never) : Void -> String; } = new A("foo");
//eq("foo", x.test());
//}
}

0 comments on commit 4806487

Please sign in to comment.