TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations
Nathan Shively-Sanders 368db997ed
ESNext+[[Define]]: reference to param props illegal (#36425)
* ESNext+[[Define]]: reference to param props illegal

When target: "esnext" and useDefineForClassFields: true, property
declaration initialisers should not be able to reference parameter
properties; class fields are initialised before the constructor runs,
but parameter properties are not:

```ts
class C {
  foo = this.bar
  constructor(public bar: string) { }
}
```

emits code that looks like this:

```js
class C {
  bar
  foo = this.bar
  constructor(bar) {
    this.bar = bar
  }
}
new C('x').foo.length // crashes; foo is undefined
```

This PR adds an error on foo's declaration with ESNext+[[Define]].

* improve test
2020-01-24 14:53:28 -08:00
..
memberAccessorDeclarations Allow accessors in ambient class declarations (#32787) 2019-08-09 16:11:25 -07:00
memberFunctionDeclarations
accessibilityModifiers.ts
accessorsOverrideMethod.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty2.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty3.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty4.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty5.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty6.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty7.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
assignParameterPropertyToPropertyDeclarationESNext.ts ESNext+[[Define]]: reference to param props illegal (#36425) 2020-01-24 14:53:28 -08:00
constructorParameterShadowsOuterScopes.ts
defineProperty.ts Fixes broken emit with useDefineForClassFields + private field (#35898) 2020-01-09 10:21:49 -08:00
definePropertyOutputES3.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
derivedUninitializedPropertyDeclaration.ts Allow references to uninitialized ambient properties (#36112) 2020-01-10 10:50:05 -08:00
initializerReferencingConstructorLocals.ts
initializerReferencingConstructorParameters.ts
instanceMemberInitialization.ts Move class property transform (#31848) 2019-06-17 14:26:42 -07:00
instanceMemberWithComputedPropertyName.ts Fix visitLexicalEnvironment to properly merge hoisted declarations (#33219) 2019-09-03 15:29:41 -07:00
instanceMemberWithComputedPropertyName2.ts Emit computed property temps even w/o init w/useDefineForClassFields (#34406) 2019-10-18 13:23:38 -07:00
optionalMethod.ts strip QuestionToken from MethodDeclaration and PropertyDeclaration emit (#34954) 2019-11-12 10:30:46 -08:00
optionalProperty.ts strip QuestionToken from MethodDeclaration and PropertyDeclaration emit (#34954) 2019-11-12 10:30:46 -08:00
overrideInterfaceProperty.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyAndAccessorWithSameName.ts
propertyAndFunctionWithSameName.ts
propertyNamedConstructor.ts
propertyNamedPrototype.ts
propertyOverridesAccessors.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors2.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors3.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors4.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors5.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesMethod.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
staticAndNonStaticPropertiesSameName.ts
staticMemberInitialization.ts
staticPropertyAndFunctionWithSameName.ts
staticPropertyNameConflicts.ts
staticPropertyNameConflictsInAmbientContext.ts
strictPropertyInitialization.ts Fixed unreported strict property initialization violations. (#35891) 2020-01-08 15:15:20 -08:00
thisInInstanceMemberInitializer.ts
thisPropertyOverridesAccessors.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
twoAccessorsWithSameName.ts
twoAccessorsWithSameName2.ts