-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the recovery rule for 'new' to use expression_recovery.
Fixes tivo/intellij-haxe #229 Added a unit test for the 'new' command.
- Loading branch information
Showing
5 changed files
with
531 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Tests parsing 'new' in a ternary expression */ | ||
|
||
package test_tivo_229; | ||
|
||
class A { | ||
public function new() {} | ||
} | ||
|
||
class B extends A { | ||
public function new() { super(); } | ||
} | ||
|
||
class C extends B { | ||
public function new( a:A ) { } | ||
} | ||
|
||
class test { | ||
public function getA(want_a:Boolean):A { | ||
var qqq = (want_a == true) ? new A() : new B(); | ||
return qqq; | ||
} | ||
|
||
public function getB(want_a:Boolean):A { | ||
var qqq = null != new B() ? new A() : new B(); | ||
return qqq; | ||
} | ||
|
||
public function getC(want_a:Boolean):A { | ||
var qqq = null != new B() ? want_a == true ? new A() : new B() : want_a == false ? new A() : new B(); | ||
return qqq; | ||
} | ||
|
||
public function compareNew() : Boolean { | ||
return new A() == new B(); | ||
} | ||
|
||
public function getChain() : C { | ||
return new C( new C( new C( new A() ))); | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.