mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 01:43:59 -05:00
Added a test for branched returns at the end of a constructor.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// @target: es5
|
||||
// @sourcemap: true
|
||||
|
||||
class C {
|
||||
cProp = 10;
|
||||
|
||||
foo() { return "this never gets used."; }
|
||||
|
||||
constructor(value: number) {
|
||||
return {
|
||||
cProp: value,
|
||||
foo() {
|
||||
return "well this looks kinda C-ish.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
dProp = () => this;
|
||||
|
||||
constructor(a = 100) {
|
||||
super(a);
|
||||
|
||||
if (Math.random() < 0.5) {
|
||||
"You win!"
|
||||
return {
|
||||
cProp: 1,
|
||||
dProp: () => this,
|
||||
foo() { return "You win!!!!!" }
|
||||
};
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user