mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update to match old TS version: parameter properties after prologue
This commit is contained in:
@@ -1359,22 +1359,16 @@ namespace ts {
|
||||
if (parameterPropertyDeclarationCount > 0) {
|
||||
const parameterProperties = visitNodes(constructor.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
||||
|
||||
// If there was a super() call found, add parameter properties immediately after it
|
||||
if (superStatementIndex >= 0) {
|
||||
addRange(statements, parameterProperties);
|
||||
}
|
||||
let superAndPrologueStatementCount = prologueStatementCount;
|
||||
// If a synthetic super() call was added, add them just after it
|
||||
else if (needsSyntheticConstructor) {
|
||||
statements = [
|
||||
statements[0],
|
||||
...parameterProperties,
|
||||
...statements.slice(1),
|
||||
];
|
||||
}
|
||||
// Since there wasn't a super() call, add them to the top of the constructor
|
||||
else {
|
||||
statements = [...parameterProperties, ...statements];
|
||||
if (needsSyntheticConstructor) {
|
||||
superAndPrologueStatementCount += 1;
|
||||
}
|
||||
statements = [
|
||||
...statements.slice(0, superAndPrologueStatementCount),
|
||||
...parameterProperties,
|
||||
...statements.slice(superAndPrologueStatementCount),
|
||||
];
|
||||
|
||||
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
||||
}
|
||||
|
||||
+2
-2
@@ -45,8 +45,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
||||
var _A_privateField, _B_privateField;
|
||||
class A {
|
||||
constructor(arg, exposedField) {
|
||||
this.exposedField = exposedField;
|
||||
var _a;
|
||||
this.exposedField = exposedField;
|
||||
_A_privateField.set(this, void 0);
|
||||
(_a = this, { key: ({ set value(_b) { __classPrivateFieldSet(_a, _A_privateField, _b, "f"); } }).value } = arg);
|
||||
}
|
||||
@@ -58,9 +58,9 @@ class A {
|
||||
_A_privateField = new WeakMap();
|
||||
class B {
|
||||
constructor(arg, exposedField) {
|
||||
this.exposedField = exposedField;
|
||||
"prologue";
|
||||
var _a;
|
||||
this.exposedField = exposedField;
|
||||
_B_privateField.set(this, void 0);
|
||||
(_a = this, { key: ({ set value(_b) { __classPrivateFieldSet(_a, _B_privateField, _b, "f"); } }).value } = arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user