|
@@ -15,24 +15,25 @@ private abstract MyEnum(String) to String {
|
|
|
|
|
|
@:analyzer(no_check_has_effect)
|
|
|
class TestLocalDce {
|
|
|
- @:js('3;')
|
|
|
+ @:js('console.log(3);')
|
|
|
static function testNoOpRemoval() {
|
|
|
1;
|
|
|
2;
|
|
|
{}
|
|
|
- 3;
|
|
|
+ trace(3);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- 27;
|
|
|
+ console.log(27);
|
|
|
')
|
|
|
static function testConstMath() {
|
|
|
var a = 1 + 2;
|
|
|
var b = 9 * 3;
|
|
|
+ trace(b);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- "foo";
|
|
|
+ console.log("foo");
|
|
|
')
|
|
|
static function testInlineCtor1() {
|
|
|
var c = new InlineCtor(12, "foo");
|
|
@@ -40,10 +41,11 @@ class TestLocalDce {
|
|
|
c.x = 13;
|
|
|
x = c.x;
|
|
|
var y = c.y;
|
|
|
+ trace(y);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- 12;
|
|
|
+ console.log(12);
|
|
|
')
|
|
|
static function testInlineCtor2() {
|
|
|
var a = 0;
|
|
@@ -52,11 +54,11 @@ class TestLocalDce {
|
|
|
a = 2;
|
|
|
new InlineCtor(12, "foo");
|
|
|
}
|
|
|
- a = c.x;
|
|
|
+ trace(a = c.x);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- 1;
|
|
|
+ console.log(1);
|
|
|
')
|
|
|
static function testInlineCtor3() {
|
|
|
var a = 0;
|
|
@@ -65,11 +67,11 @@ class TestLocalDce {
|
|
|
a = 1;
|
|
|
new InlineCtor(2, "b");
|
|
|
}
|
|
|
- b.x = a;
|
|
|
+ trace(b.x = a);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- 2;
|
|
|
+ console.log(2);
|
|
|
')
|
|
|
static function testStructureInline1() {
|
|
|
var x = {
|
|
@@ -78,47 +80,53 @@ class TestLocalDce {
|
|
|
}
|
|
|
var y = x.foo;
|
|
|
var z = x.bar;
|
|
|
+ trace(z);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- "god";
|
|
|
+ TestLocalDce.keep("god");
|
|
|
')
|
|
|
static function testStructureInlineInvalidField() {
|
|
|
var x = {
|
|
|
- "oh-my": "god"
|
|
|
+ "oh-my": keep("god")
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- 2;
|
|
|
+ console.log(2);
|
|
|
')
|
|
|
static function testArrayInline() {
|
|
|
var a = [1, 2];
|
|
|
var b = a.length;
|
|
|
+ trace(b);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
var a = [1,2];
|
|
|
- a[-1];
|
|
|
+ console.log(a[-1]);
|
|
|
')
|
|
|
static function testArrayInlineCancelNegative() {
|
|
|
var a = [1, 2];
|
|
|
- a[-1];
|
|
|
+ trace(a[-1]);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
var a = [1,2];
|
|
|
- a[2];
|
|
|
+ console.log(a[2]);
|
|
|
')
|
|
|
static function testArrayInlineCancelExceeds() {
|
|
|
var a = [1, 2];
|
|
|
- a[2];
|
|
|
+ trace(a[2]);
|
|
|
}
|
|
|
|
|
|
@:js('
|
|
|
- "" + "a";
|
|
|
+ var s = "" + "a";
|
|
|
+ console.log(s);
|
|
|
')
|
|
|
static function testAbstractOverStringBinop() {
|
|
|
var s = "" + A;
|
|
|
+ trace(s);
|
|
|
}
|
|
|
+
|
|
|
+ static function keep(v) { return v; }
|
|
|
}
|