Propagate isRestParameter through symbol instantiation (#18087)

* Add repro from #17666

* Actually use repro from issue, propegate isRestParameter on instantiation
This commit is contained in:
Wesley Wigham
2017-08-31 10:15:42 -07:00
committed by GitHub
parent e294b23500
commit 3e850156da
5 changed files with 116 additions and 0 deletions

View File

@@ -8168,6 +8168,9 @@ namespace ts {
if (symbol.valueDeclaration) {
result.valueDeclaration = symbol.valueDeclaration;
}
if ((symbol as TransientSymbol).isRestParameter) {
result.isRestParameter = (symbol as TransientSymbol).isRestParameter;
}
return result;
}

View File

@@ -0,0 +1,42 @@
//// [File.js]
class Parent {
initialize() {
super.initialize(...arguments)
return this.asdf = ''
}
}
class Child extends Parent {
initialize() {
}
}
//// [File.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Parent = /** @class */ (function () {
function Parent() {
}
Parent.prototype.initialize = function () {
_super.prototype.initialize.apply(this, arguments);
return this.asdf = '';
};
return Parent;
}());
var Child = /** @class */ (function (_super) {
__extends(Child, _super);
function Child() {
return _super !== null && _super.apply(this, arguments) || this;
}
Child.prototype.initialize = function () {
};
return Child;
}(Parent));

View File

@@ -0,0 +1,25 @@
=== tests/cases/compiler/File.js ===
class Parent {
>Parent : Symbol(Parent, Decl(File.js, 0, 0))
initialize() {
>initialize : Symbol(Parent.initialize, Decl(File.js, 0, 14))
super.initialize(...arguments)
>arguments : Symbol(arguments)
return this.asdf = ''
>this.asdf : Symbol(Parent.asdf, Decl(File.js, 3, 14))
>this : Symbol(Parent, Decl(File.js, 0, 0))
>asdf : Symbol(Parent.asdf, Decl(File.js, 3, 14))
}
}
class Child extends Parent {
>Child : Symbol(Child, Decl(File.js, 5, 3))
>Parent : Symbol(Parent, Decl(File.js, 0, 0))
initialize() {
>initialize : Symbol(Child.initialize, Decl(File.js, 7, 28))
}
}

View File

@@ -0,0 +1,32 @@
=== tests/cases/compiler/File.js ===
class Parent {
>Parent : Parent
initialize() {
>initialize : (...args: any[]) => string
super.initialize(...arguments)
>super.initialize(...arguments) : any
>super.initialize : any
>super : any
>initialize : any
>...arguments : any
>arguments : IArguments
return this.asdf = ''
>this.asdf = '' : ""
>this.asdf : string
>this : this
>asdf : string
>'' : ""
}
}
class Child extends Parent {
>Child : Child
>Parent : Parent
initialize() {
>initialize : () => void
}
}

View File

@@ -0,0 +1,14 @@
// @allowjs: true
// @outDir: ../
// @filename: File.js
class Parent {
initialize() {
super.initialize(...arguments)
return this.asdf = ''
}
}
class Child extends Parent {
initialize() {
}
}