Included previously ignored baseline .js file and slight refactoring

This commit is contained in:
AbubakerB 2016-02-14 21:16:12 +00:00
parent 2d7a0f4a25
commit ba8b1680cb
2 changed files with 96 additions and 4 deletions

View File

@ -15412,14 +15412,13 @@ namespace ts {
function isNodeWithinClass(node: Node, classDeclaration: ClassLikeDeclaration) {
while (true) {
const containingClass = getContainingClass(node);
if (!containingClass) {
node = getContainingClass(node);
if (!node) {
return false;
}
if (containingClass === classDeclaration) {
if (node === classDeclaration) {
return true;
}
node = containingClass;
}
}

View File

@ -0,0 +1,93 @@
//// [classConstructorAccessibility4.ts]
class A {
private constructor() { }
method() {
class B {
method() {
new A(); // OK
}
}
class C extends A { // OK
}
}
}
class D {
protected constructor() { }
method() {
class E {
method() {
new D(); // OK
}
}
class F extends D { // OK
}
}
}
//// [classConstructorAccessibility4.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
}
A.prototype.method = function () {
var B = (function () {
function B() {
}
B.prototype.method = function () {
new A(); // OK
};
return B;
}());
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
}(A));
};
return A;
}());
var D = (function () {
function D() {
}
D.prototype.method = function () {
var E = (function () {
function E() {
}
E.prototype.method = function () {
new D(); // OK
};
return E;
}());
var F = (function (_super) {
__extends(F, _super);
function F() {
_super.apply(this, arguments);
}
return F;
}(D));
};
return D;
}());
//// [classConstructorAccessibility4.d.ts]
declare class A {
private constructor();
method(): void;
}
declare class D {
protected constructor();
method(): void;
}